-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(helm): resolve RBAC permissions for namespaced gateway sources #5578
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
fix(helm): resolve RBAC permissions for namespaced gateway sources #5578
Conversation
|
Hi @u-kai. 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. |
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.
Not sure if this is the correct solution. Why gateway have a distinct flag, when rest of the sources rely on --namespace ? Is there is a specific reason or a mistake?
| - --namespace={{ .Release.Namespace }} | ||
| {{- end }} | ||
| {{- if .Values.gatewayNamespace }} | ||
| - --gateway-namespace={{ .Values.gatewayNamespace }} |
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.
I think one of the issues is, that Gateway actually uses --gateway-namespace when it should be unified and --namespace is just enough. This is just a confusion.
|
@ivankatliarchuk The separate The flag already exists in the external-dns, so this change maintains consistency with the existing CLI interface while fixing the RBAC permissions for namespaced deployments. |
|
/ok-to-test |
|
I found an initial PR #2292 As short term it seems like a fix. But not clear Long term solutions are
In my opinion, if |
|
Related issues:
|
|
@ivankatliarchuk That said, I’d like to clarify one point — does this proposal also imply deprecating or integrating the If so, my personal opinion is that In such cases, having a dedicated So in conclusion, I’m in favor of enabling multi-namespace support for |
|
@mloiseleur wdyt? |
|
In External DNS doc on flags, it says:
With current state of External DNS, this PR looks valid to me. It allows user to use the same namespace or different namespace, with similar names between the binary and the chart. For instance, a user may want to use external dns CRD on external-dns namespace and Gateway on gateway namespaces. @ivankatliarchuk An answer to your idea would be to implement a |
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.
@u-kai About the implementation, why are you adding a specific ClusterRole and ClusterRoleBinding ? Wouldn't it be simpler to use the same CR & CRB with just extended required permissions ?
|
Make sense |
|
@mloiseleur Let me explain the implementation. For Technical Requirements:
Implementation Approach:
This design grants exactly the permissions needed for each scenario while maintaining security isolation. |
|
/assign @stevehipwell |
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 @u-kai. I've added a comment suggesting an improvement but as I'd like to include this in the next release we can leave that for the next time we need to make changes.
/approve
| Check if any Gateway API sources are enabled | ||
| */}} | ||
| {{- define "external-dns.hasGatewaySources" -}} | ||
| {{- if or (has "gateway-httproute" .Values.sources) (has "gateway-grpcroute" .Values.sources) (has "gateway-tlsroute" .Values.sources) (has "gateway-tcproute" .Values.sources) (has "gateway-udproute" .Values.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.
Why not use hasPrefix in a range loop so the code is less likely to need updating in the future?
|
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@mloiseleur @ivankatliarchuk could one of you please add the LGTM if you're happy with this? |
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.
/lgtm
…ubernetes-sigs#5578) * fix(helm): resolve RBAC permissions for namespaced gateway sources * feat(helm): add support for gateway namespace in RBAC configuration * chore(helm): update docs and fix formatting issues * fix(helm): revert README changes and add gatewayNamespace docs * chore lint fmt
What does it do ?
This PR resolves RBAC permission issues when using Gateway API sources with
namespaced: trueconfiguration in the Helm chart.It implements proper conditional RBAC creation that supports both same-namespace and cross-namespace gateway access scenarios while maintaining backward compatibility.
Motivation
Fixes #5300 - Gateway API sources require ClusterRole permissions when using
namespaced: true, but the current implementation creates insufficient Role permissions, causing external-dns to fail with RBAC errors.Problem: When
namespaced: trueis set with gateway sources, external-dns needs:namespacesresource)gatewayNamespaceconfiguration)Root Cause: The namespace informer uses
NamespacesFromSelectorfunctionality which requires cluster-wide namespace access, butnamespaced: trueonly creates Role permissions.Solution
Implements Split RBAC approach with conditional logic:
Scenarios Supported:
namespaced=false+ gateway sources → ClusterRole with all permissionsnamespaced=true+ gateway sources + nogatewayNamespace→ Main Role (with gateway permissions) + ClusterRole for namespacesnamespaced=true+ gateway sources +gatewayNamespacespecified → Main Role + ClusterRole for namespaces + Cross-namespace Gateway Rolenamespaced=false/true+ no gateway sources → Standard behavior (unchanged)More