🐛 fix: allow cluster-scoped resources to bypass allowedNamepsaces checks#6080
🐛 fix: allow cluster-scoped resources to bypass allowedNamepsaces checks#6080andclt wants to merge 1 commit into
Conversation
|
Hi @andclt. 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 Regular contributors should join the org to skip this step. 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. |
7f80a66 to
6c803c6
Compare
3e2f8e8 to
f850ecd
Compare
|
/assign @nrb |
|
/ok-to-test |
f850ecd to
9c8203d
Compare
9c8203d to
b810e54
Compare
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: f7f0e962693f6fe4cd52a61e15c27d4431778c7c |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nrb 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 |
|
/hold for testing |
|
/test ? |
|
/test pull-cluster-api-provider-aws-e2e |
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR fixes a bug where cluster-scoped resources cannot use AWS identities that have
allowedNamespacesrestrictions.The permission check in
isClusterPermittedToUsePrincipal()assumes all resources have a namespace, but cluster-scoped resources return an empty namespace (""), causing them to failallowedNamespacesvalidation even when they should be allowed.This fix allows cluster-scoped resources to bypass
allowedNamespaceschecks since:allowedNamespacesfield is designed for namespace-scoped resources to enforce multi-tenancyChanges:
isClusterScopedResource()helper that usesRESTMapperto query resource scope metadata from CRD definitions.allowedNamespacesvalidationWhich issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #6087
https://redhat.atlassian.net/browse/ROSAENG-60948
Special notes for your reviewer:
AI Usage:
None
Checklist:
Release note: