Skip to content

fix: align --resources-to-ignore=configMaps with renamed ResourceMap key#1145

Merged
msafwankarim merged 4 commits into
stakater:masterfrom
yvjessestephens:fix/configmaps-resources-to-ignore-mismatch
Jun 15, 2026
Merged

fix: align --resources-to-ignore=configMaps with renamed ResourceMap key#1145
msafwankarim merged 4 commits into
stakater:masterfrom
yvjessestephens:fix/configmaps-resources-to-ignore-mismatch

Conversation

@yvjessestephens

@yvjessestephens yvjessestephens commented May 20, 2026

Copy link
Copy Markdown
Contributor

Background

I came across this regression while rolling out a Renovate-proposed chart bump from chart-v2.2.5 to chart-v2.2.11 in one of our staging clusters. We run Reloader with reloader.ignoreConfigMaps: true because configmap reload is already handled by Argo CD in our environment, and we don't want both tools fighting each other.

Once Argo CD synced the change, the Reloader pod immediately started spamming the log:

E0520 19:06:54.516332 1 reflector.go:204] "Failed to watch" err="failed to list *v1.ConfigMap: configmaps is forbidden: User \"system:serviceaccount:reloader:reloader-reloader\" cannot list resource \"configmaps\" in API group \"\" at the cluster scope"

even though the pod also clearly logged:

time="..." level=info msg="created controller for: configmaps"
time="..." level=info msg="Starting Controller to watch resource type: configmaps"

That was the surprise — ignoreConfigMaps: true was set, the chart deliberately omits configmap RBAC when that flag is true, and yet a configmap controller was being created and trying to list cluster-wide. Rolling back to chart-v2.2.5 made the errors disappear.

Tracing through the code revealed a silent mismatch introduced in #1061.

Root cause

#1061 renamed the configmap key in kube.ResourceMap from configMaps (camelCase) to configmaps (lowercase) so controllers could mark themselves as initialized. Two callers were not updated to match:

  1. deployments/kubernetes/chart/reloader/templates/deployment.yaml still emits --resources-to-ignore=configMaps (camelCase) when reloader.ignoreConfigMaps: true is set.
  2. internal/pkg/util/util.go GetIgnoredResourcesList only accepts the legacy camelCase spelling.

Because ignoredResourcesList.Contains(k) uses case-sensitive equality, the filter at internal/pkg/cmd/reloader.go:167 never matches the new lowercase configmaps key. The configmaps controller is created and starts watching ConfigMaps cluster-wide, even though the chart's ClusterRole template (also gated on ignoreConfigMaps) does not grant permission for it.

This regression has been present since chart-v2.2.6 / app v1.4.11.

Changes

  • Chart deployment template emits the canonical lowercase configmaps value.
  • GetIgnoredResourcesList normalizes input, accepting both configMaps (legacy, BC for users passing the flag directly) and configmaps (canonical), emitting the canonical form to the caller.
  • Updated flag help text.
  • New tests covering both spellings, invalid input, and the "both" rejection.

Test plan

  • go test ./internal/pkg/util/...
  • helm template ... --set reloader.ignoreConfigMaps=true renders --resources-to-ignore=configmaps
  • (reviewer) Deploy chart with ignoreConfigMaps: true and confirm no configmaps is forbidden RBAC errors

PR stakater#1061 renamed the configmap key in kube.ResourceMap from "configMaps"
(camelCase) to "configmaps" (lowercase) to fix controllers not being
able to mark themselves as initialized. However, two callers were not
updated to match the new canonical key:

1. The Helm chart's deployment template still emits
   `--resources-to-ignore=configMaps` (camelCase) when
   `reloader.ignoreConfigMaps: true` is set.
2. The validation in `GetIgnoredResourcesList` only accepts the legacy
   camelCase spelling.

Because `ignoredResourcesList.Contains(k)` uses case-sensitive string
equality, the lookup against the new lowercase ResourceMap key never
matches. The configmaps controller is created and starts watching
ConfigMaps cluster-wide, even though the chart's ClusterRole template
(also gated on `ignoreConfigMaps`) does not grant permission for it.

The resulting pod logs are full of:

  configmaps is forbidden: User "system:serviceaccount:reloader:reloader-reloader"
  cannot list resource "configmaps" in API group "" at the cluster scope

This change:

- Updates the chart deployment template to emit the canonical lowercase
  `configmaps` value.
- Normalizes the input in `GetIgnoredResourcesList`, accepting both
  `configMaps` (legacy, for backward compatibility with users who pass
  the flag directly) and `configmaps` (canonical), and emitting the
  canonical form to the caller.
- Updates the flag help text and adds tests covering both spellings.
@msafwankarim

Copy link
Copy Markdown
Contributor

@yvjessestephens Thank you for the PR submission. Please re-sync your fork against master to fix Helm Chart Validation pipeline

@yvjessestephens

Copy link
Copy Markdown
Contributor Author

@yvjessestephens Thank you for the PR submission. Please re-sync your fork against master to fix Helm Chart Validation pipeline

@msafwankarim done, I sync'd the fork, let me know if that looks good.

Comment thread internal/pkg/util/util.go
Comment thread internal/pkg/util/util.go Outdated
yvjessestephens and others added 2 commits June 12, 2026 08:29
Use strings.ToLower so any casing (configMaps, ConfigMaps, sEcrets)
normalizes to the canonical lowercase ResourceMap key, and simplify the
flag help text. Addresses PR review feedback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants