Skip to content

Tenant identity validation - #2138

Merged
gianlucam76 merged 2 commits into
projectsveltos:mainfrom
gianlucam76:tenant-identity-validation
Dec 2, 2026
Merged

gianlucam76 merged 2 commits into
projectsveltos:mainfrom
gianlucam76:tenant-identity-validation

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

No description provided.

…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.
@gianlucam76
gianlucam76 merged commit 121e3e2 into projectsveltos:main Dec 2, 2026
14 checks passed
@gianlucam76
gianlucam76 deleted the tenant-identity-validation branch December 2, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant