-
Couldn't load subscription status.
- Fork 2.8k
fix(charts): Skip cluster-scope RBAC on namespaced #5843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(charts): Skip cluster-scope RBAC on namespaced #5843
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @TobyTheHutt. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
* Restore tenant-friendly installs by keeping RBAC namespaced if `.Values.gatewayNamespace` is set * `namespaced=true` and `gatewayNamespace` set results in a namespaced Role and Rolebinding for listing namespaces * `namespaced=true` AND `gatewayNamespace` unset will retain the original `ClusterRole` and `ClusterRoleBinding` * `namespace=false` will retain the original `ClusterRole` and `ClusterRoleBinding` * No breaking changes introduced Ticket: kubernetes-sigs#5832 Signed-off-by: Tobias Harnickell <[email protected]>
3e5dabb to
b9476b6
Compare
|
Thank you for addressing the RBAC scoping issue! The changes look well thought-out and restore tenant-friendly installs by correctly handling namespaced RBAC when .Values.gatewayNamespace is set. I appreciate the clear documentation and the test cases you provided. A few points: The logic for retaining ClusterRole/ClusterRoleBinding vs. Role/RoleBinding is clearly explained and matches expected behaviors for tenant scenarios. Are there any edge cases where setting both namespaced=true and leaving gatewayNamespace unset could lead to unexpected permission escalation? |
|
Thanks for the review. To your questions: Permission escalation risk: Upgrade path ...and... If a user moves from cluster-scoped to namespaced, it still flips the main RBAC objects from ClusterRole and ClusterRoleBinding to Role and RoleBinding, as this is treated as a usual kind swap in Helm. It will delete the cluster-scoped pair and replace them with namespaced equivalents. BUT: Users need to remember to set Next steps I think the changes implemented are safe and any issues that may arise from them can be remedied with simple and obvious measures.
Let me know how we want to proceed. |
|
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @TobyTheHutt. I've commented on a minor nit to fix and could you also add this change to the chart CHANGELOG?
| # When `namespaced=true`, setting this value avoids creating any cluster-scoped RBAC | ||
| # (no ClusterRole/ClusterRoleBinding) for Gateway sources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # When `namespaced=true`, setting this value avoids creating any cluster-scoped RBAC | |
| # (no ClusterRole/ClusterRoleBinding) for Gateway sources. | |
| # When `namespaced=true`, setting this value avoids creating any cluster-scoped RBAC | |
| # (no ClusterRole/ClusterRoleBinding) for Gateway sources. |
What does it do ?
.Values.gatewayNamespaceis setnamespaced=trueandgatewayNamespaceset results in a namespaced Role and Rolebinding for listing namespacesnamespaced=trueANDgatewayNamespaceunset will retain the originalClusterRoleandClusterRoleBindingalong with aRoleandRoleBindingnamespace=falsewill retain the originalClusterRoleandClusterRoleBindingThe Helm Linter and Tests were run and the templates get rendered as expected:
helm template charts/external-dns --set namespaced=true --set sources[0]=gateway-httproute --set gatewayNamespace=gateway-nshelm template charts/external-dns --set namespaced=true --set sources[0]=gateway-httproutehelm template charts/external-dns --set namespaced=false --set sources[0]=gateway-httprouteMotivation
When installing with namespaced=true and gateway sources, a270a32 added a
ClusterRole/ClusterRoleBindingwhich breaks tenant setups that disallow cluster-scoped permissions.This change keeps RBAC namespaced when
.Values.gatewayNamespaceis set.Fixes: #5832
More