fix: Normalize resources-to-ignore values to match ResourceMap keys#1088
fix: Normalize resources-to-ignore values to match ResourceMap keys#1088rafaelperoco wants to merge 1 commit into
Conversation
797a721 to
edfc3a1
Compare
edfc3a1 to
2f9bf33
Compare
|
@TheiLLeniumStudios can you please review it? |
|
review please |
|
@TheiLLeniumStudios could you please review it? |
There was a problem hiding this comment.
Pull request overview
This PR fixes a mismatch between the --resources-to-ignore flag values (e.g., configMaps) and kube.ResourceMap keys (lowercase like configmaps), which previously prevented configmaps from being ignored and could lead to RBAC permission errors (issue #1068).
Changes:
- Normalize
GetIgnoredResourcesList()output to lowercase so it matcheskube.ResourceMapkeys. - Add unit tests covering
GetIgnoredResourcesList()behavior and error cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/pkg/util/util.go | Normalizes ignored resource names to lowercase for consistent matching against ResourceMap keys. |
| internal/pkg/util/util_test.go | Adds unit tests for ignored-resources parsing/validation and normalization behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| normalizedList := make(List, len(ignoredResourcesList)) | ||
| for i, v := range ignoredResourcesList { | ||
| normalizedList[i] = strings.ToLower(v) | ||
| } |
| { | ||
| name: "configMaps normalized to lowercase", | ||
| resources: []string{"configMaps"}, | ||
| expectError: false, | ||
| expected: []string{"configmaps"}, | ||
| }, | ||
| { | ||
| name: "secrets stays lowercase", | ||
| resources: []string{"secrets"}, | ||
| expectError: false, | ||
| expected: []string{"secrets"}, | ||
| }, |
|
Hi, We use reloader in our setup. And facing this bug. I wanted to know by when this fix would be available and in which release so that we can also plan our upgrades accordingly. Thanks |
|
Hi @Ankita-Eric! This feature has been merged via #1145 and released in v1.4.18 |
Summary
--resources-to-ignore=configMaps(camelCase) andResourceMapkeys (configmapslowercase)GetIgnoredResourcesListfunctionProblem
When using
ignoreConfigMaps: truein Helm values, the generated--resources-to-ignore=configMapsflag was not working becauseResourceMapuses lowercase keys. This caused permission errors when RBAC was configured without configmaps access.Solution
Normalize the ignored resources list to lowercase in
GetIgnoredResourcesList()to matchResourceMapkeys.Fixes #1068