Skip to content

Automate helm ClusterRole RBAC sync from kubebuilder#4686

Open
shraddhabang wants to merge 1 commit intokubernetes-sigs:mainfrom
shraddhabang:helmsync
Open

Automate helm ClusterRole RBAC sync from kubebuilder#4686
shraddhabang wants to merge 1 commit intokubernetes-sigs:mainfrom
shraddhabang:helmsync

Conversation

@shraddhabang
Copy link
Copy Markdown
Collaborator

Issue

We've had repeated issues where developers add new kubebuilder RBAC markers but forget to update the helm chart's ClusterRole, causing helm-installed controllers to have missing permissions. The helm rbac.yaml was maintained by hand, separate from the kubebuilder-generated role.yaml, and over time they drifted — different resource groupings, missing rules, verb ordering mismatches.

Description

This PR eliminates that problem by making role.yaml the single source of truth for the controller's ClusterRole rules. The sync now runs automatically as part of make manifests, so there's no extra step to remember. A CI check (verify-rbac-sync in quick-ci) catches any drift if someone bypasses the Makefile.

Scope:

This sync only covers the ClusterRole rules (the controller's own permissions). The following are not synced and remain hand-maintained in the helm chart and/or the sync script:

  • Leader election Role and RoleBinding (helm-templated with release-specific names/namespaces)
  • Conditional secrets permission (clusterSecretsPermissions.allowAllSecrets — helm-only, no kubebuilder equivalent)
  • ClusterRoleBinding (helm-templated)

If any of these need changes, update sync-rbac-to-helm.sh directly.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 13, 2026
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2026
Comment thread hack/verify-rbac-sync.sh Outdated

changed_files=$(git status --porcelain --untracked-files=no -- helm/aws-load-balancer-controller/templates/rbac.yaml || true)
if [ -n "${changed_files}" ]; then
echo "Detected that helm RBAC is out of sync with kubebuilder RBAC; run 'make sync-rbac'"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message is suggesting run make, do we need to also add sync-rbac to make file. Right now it is only part of make manifests

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shraddhabang, wweiwei-li

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [shraddhabang,wweiwei-li]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants