You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Kubernetes RBAC aggregation (aggregationRule in ClusterRoles/Roles), helm-controller's drift detection incorrectly identifies the auto-populated rules field as drift and attempts to remove it, causing a reconciliation loop.
Steps to reproduce
Deploy a HelmRelease with drift detection enabled
Include a ClusterRole with aggregationRule but no rules field in the Helm chart:
Kubernetes' clusterrole-aggregation-controller automatically populates the rules field
helm-controller detects drift (rules present in cluster vs. absent in chart manifest)
helm-controller attempts to remove the rules via drift correction
Aggregation controller immediately re-adds them
Loop continues on next reconciliation
Expected behavior
helm-controller should automatically ignore the rules field during drift detection when aggregationRule is present, similar to how kustomize-controller handles this (see fluxcd/kustomize-controller#1041).
Actual behavior
Continuous drift detection and correction attempts, causing unnecessary reconciliation loops and events.
The normalization skip for ClusterRole/Role already exists in fluxcd/pkg/ssa/normalize but only prevents setting rules: null during normalization, not during drift detection comparison
Root cause: Kubernetes API design where the rules field lacks omitempty despite being optional when aggregationRule is used
Describe the bug
When using Kubernetes RBAC aggregation (
aggregationRulein ClusterRoles/Roles), helm-controller's drift detection incorrectly identifies the auto-populatedrulesfield as drift and attempts to remove it, causing a reconciliation loop.Steps to reproduce
aggregationRulebut norulesfield in the Helm chart:clusterrole-aggregation-controllerautomatically populates therulesfieldExpected behavior
helm-controller should automatically ignore the
rulesfield during drift detection whenaggregationRuleis present, similar to how kustomize-controller handles this (see fluxcd/kustomize-controller#1041).Actual behavior
Continuous drift detection and correction attempts, causing unnecessary reconciliation loops and events.
Workaround
Add an ignore rule to the HelmRelease:
Or disable drift detection entirely for the resource with an annotation:
Proposed solution
Automatically ignore
/rulespath during drift detection when:ClusterRoleorRolerbac.authorization.k8s.io/v1aggregationRulefield presentThis should be implemented in the
Diff()function ininternal/action/diff.goby dynamically adding an ignore rule for aggregated RBAC resources.Additional context
fluxcd/pkg/ssa/normalizebut only prevents settingrules: nullduring normalization, not during drift detection comparisonrulesfield lacksomitemptydespite being optional whenaggregationRuleis used