Repository navigation
feat(globalproxysettings): add Tenant subject kind - #1151
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
GlobalProxySettings subjects could only be User, Group or ServiceAccount.
That works poorly for promoted ServiceAccounts: tenant owners create them
dynamically, so cluster administrators cannot know their names in advance
and would have to maintain one GlobalProxySettings entry per account.
Add a Tenant subject kind. A subject {kind: Tenant, name: solar} matches
every caller that currently owns Tenant "solar", whether as User, Group or
promoted ServiceAccount. Non-owners and owners of other Tenants get
nothing from the rule, and removing ownership revokes the grant.
Resolution reuses the existing Tenant owner index already queried for the
caller and the GlobalProxySettings subject index, so no extra API calls
are made. Lookups happen only with the ProxyClusterScoped feature gate
enabled. A Tenant is resolved once per request even when the caller owns
it through several identities (user plus groups), avoiding duplicated
rules.
GlobalSubject.Kind gets its own GlobalSubjectKind type so the CRD enum can
include Tenant without widening the kind accepted for namespaced
ProxySettings owners. CRD regenerated with controller-gen v0.22.0.
Adds unit tests (subject matching, user/group/serviceaccount identities,
gate on/off, ownership revocation, once-only resolution), a benchmark and
an e2e scenario with two tenants, plus README documentation.
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
NopeCharon
force-pushed
the
feat/globalproxysettings-tenant-subject
branch
from
November 20, 2026 08:52
217ac47 to
f437e6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1131
Adds a
Tenantsubject kind toGlobalProxySettings:It matches every caller that currently owns Tenant
solar, whether as User, Group or promoted ServiceAccount. Non-owners and owners of other Tenants get nothing from the rule, and removing ownership revokes the grant. This removes the need to maintain oneGlobalProxySettingsentry per dynamically created promoted ServiceAccount.GlobalProxySettingsis affected, and only with theProxyClusterScopedfeature gate enabled. NamespacedProxySettingis unchanged.GlobalProxySettingssubject index (Tenant:<name>), so no extra API calls are made. A Tenant is resolved once per request even if the caller owns it through several identities, so rules are not duplicated.GlobalSubject.Kindgets its ownGlobalSubjectKindtype so the CRD enum can includeTenantwithout widening the kinds accepted forProxySettingowners. CRD regenerated with controller-gen v0.22.0.Tests
internal/tenant), end-to-end lookup for User/Group/ServiceAccount identities with gate on/off, non-owner, other tenant, ownership revocation, and once-only resolution (the latter fails without the dedupe).BenchmarkGlobalProxySettingsTenantSubject(up to 1000 unrelated namespaces): about 0.09 ms/op without a grant and 0.12 ms/op with a grant; cost does not grow with unrelated objects.e2e/global_tenant_subject_test.gowith two tenants (owner granted, owner of another tenant denied, grant revoked after ownership change). It compiles with thee2etag; it was not run locally because no cluster was available, so it relies on CI.go test -race ./...passes.