fix(charts): Skip cluster-scope RBAC on namespaced#5843
Conversation
|
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. DetailsInstructions 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 <tobias.harnickell@bedag.ch>
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 |
stevehipwell
left a comment
There was a problem hiding this comment.
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?
|
@TobyTheHutt are you planning on continuing to work on this? |
|
@stevehipwell thanks for the ping. Life happened. Yes, I'll take up work again in the coming days. |
…e-creation-on-namespaced-scopes # Conflicts: # charts/external-dns/tests/json-schema_test.yaml
Signed-off-by: Tobias Harnickell <tobias@harnickell.ch>
Pull Request Test Coverage Report for Build 21328086724Details
💛 - Coveralls |
Signed-off-by: Tobias Harnickell <tobias@harnickell.ch>
5006b41 to
395443e
Compare
Signed-off-by: Tobias Harnickell <tobias@harnickell.ch>
|
@stevehipwell I implemented the proposed changes. Again, I'm really sorry for the long wait from my side. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stevehipwell The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…_total * master: (21 commits) refactor(testutils): extract log test helpers into subpackage to fix (kubernetes-sigs#6236) chore(deps): bump mkdocs-material (kubernetes-sigs#6237) feat(endpoint): reject alias property on unsupported record types (kubernetes-sigs#6188) fix(charts): Skip cluster-scope RBAC on namespaced (kubernetes-sigs#5843) chore(deps): bump the dev-dependencies group across 1 directory with 3 updates (kubernetes-sigs#6226) feat(pdns): add --[no-]prefer-alias flag and alias annotation support (kubernetes-sigs#6129) fix(ci): failed to download the coveralls binary from GitHub releases (kubernetes-sigs#6228) docs: add external-dns-pscloud-webhook to New providers list (kubernetes-sigs#6214) fix(crd): allow trailing dot in CNAME targets (kubernetes-sigs#6218) docs: added deep wiki badge (kubernetes-sigs#6215) feat(crd): Support MX record with trailing dot (kubernetes-sigs#6163) chore(source): standardize sources with merge endpionts and deduplicate targets (kubernetes-sigs#6174) chore(store): Added RESTConfig() to ClientGenerator (kubernetes-sigs#6177) chore(ingress): clarify that both IP and Hostname are collected from LoadBalancer status (kubernetes-sigs#6138) chore(endpoint): added empty checks (kubernetes-sigs#6157) chore(linter): enable unparam (kubernetes-sigs#6160) fix(tlsutils): fix nil error wrapping and wrong env var in TLS config (kubernetes-sigs#6198) chore(endpoint): harden crypto (kubernetes-sigs#6197) feat(fqdn): Deduplicate and sort ExecTemplate output. Add functions (kubernetes-sigs#6173) benchmark(endpoint): endpoint benchmarks (kubernetes-sigs#6156) ...
* master: (23 commits) refactor(testutils): extract log test helpers into subpackage to fix (kubernetes-sigs#6236) chore(deps): bump mkdocs-material (kubernetes-sigs#6237) feat(endpoint): reject alias property on unsupported record types (kubernetes-sigs#6188) fix(charts): Skip cluster-scope RBAC on namespaced (kubernetes-sigs#5843) chore(deps): bump the dev-dependencies group across 1 directory with 3 updates (kubernetes-sigs#6226) feat(pdns): add --[no-]prefer-alias flag and alias annotation support (kubernetes-sigs#6129) fix(ci): failed to download the coveralls binary from GitHub releases (kubernetes-sigs#6228) docs: add external-dns-pscloud-webhook to New providers list (kubernetes-sigs#6214) fix(crd): allow trailing dot in CNAME targets (kubernetes-sigs#6218) docs: added deep wiki badge (kubernetes-sigs#6215) feat(crd): Support MX record with trailing dot (kubernetes-sigs#6163) chore(source): standardize sources with merge endpionts and deduplicate targets (kubernetes-sigs#6174) chore(store): Added RESTConfig() to ClientGenerator (kubernetes-sigs#6177) chore(ingress): clarify that both IP and Hostname are collected from LoadBalancer status (kubernetes-sigs#6138) chore(endpoint): added empty checks (kubernetes-sigs#6157) chore(linter): enable unparam (kubernetes-sigs#6160) fix(tlsutils): fix nil error wrapping and wrong env var in TLS config (kubernetes-sigs#6198) chore(endpoint): harden crypto (kubernetes-sigs#6197) feat(fqdn): Deduplicate and sort ExecTemplate output. Add functions (kubernetes-sigs#6173) benchmark(endpoint): endpoint benchmarks (kubernetes-sigs#6156) ...
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