Repository navigation
Tenant identity validation - #2138
Merged
gianlucam76 merged 2 commits intoDec 2, 2026
Merged
Conversation
…incomplete The labels projectsveltos.io/serviceaccount-name and projectsveltos.io/serviceaccount-namespace carry the identity a ClusterProfile/Profile is deployed with. An empty value was read as "no tenant": getClusterSummaryAdmin returned an empty name and every caller then used the addon-controller own permissions (and libsveltos selected the platform admin kubeconfig) instead of the ones of the tenant ServiceAccount. Setting one label to an empty value was enough to escape the tenant. If one of the two labels is present, both must now be set to a non empty value. Otherwise validateClusterSummaryAdmin returns a NonRetriableError and the ClusterSummary is blocked: nothing is deployed, nothing is removed, the reason is set in Status.FailureMessage and there is no requeue. A ClusterSummary being deleted is blocked as well and keeps its finalizer: something might already be deployed, so the user decides how to fix the labels (remove both or set both). For a fix to take effect, the labels must reach the ClusterSummary. Until now a label only change on the ClusterProfile/Profile was never copied (the ClusterSummary was updated only when spec or annotations changed) and a removed label was never removed. The profile reconciler now keeps the two tenant labels in sync, removal and OneTime mode included, and ClusterSummaryPredicate reconciles a ClusterSummary when a tenant label changes.
When a ClusterProfile/Profile carries the ServiceAccount labels, every resource it references is now read impersonating that ServiceAccount, so Kubernetes RBAC decides what a tenant can reference: policyRefs, kustomizationRefs, valuesFrom, patchesFrom, templateResourceRefs, helm and registry credentials, remote URL secrets and cosign keys. The Cluster object, needed to instantiate names and namespaces, is still read with the addon-controller own permissions. Without the labels nothing changes. A Profile can only reference a ServiceAccount of its own namespace: a ClusterSummary of a Profile whose ServiceAccount namespace label differs is blocked with a non retriable error. Tenant ServiceAccounts need RBAC to read the ConfigMaps, Secrets and Flux sources they reference. helmchart_version_source credentials are not covered.
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.
No description provided.