Skip to content

bug: deploymentType Local and management cluster - #1892

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:bug-1891
Jul 29, 2026
Merged

bug: deploymentType Local and management cluster#1892
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:bug-1891

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Fixes a bug where a SveltosCluster representing the management cluster itself (self-managed) matching a ClusterProfile could cause its ClusterSummary to delete resources deployed by other, unrelated ClusterSummary instances.

When a PolicyRef/KustomizationRef uses deploymentType: Local, resources are deployed into the management cluster and tagged with a projectsveltos.io/clustersummary annotation identifying the owning ClusterSummary, so stale-resource cleanup only removes what that specific ClusterSummary deployed in the management cluster. That scoping was only ever applied to the "clean the management cluster" pass. The "clean the remote/managed cluster" pass never set it, which was harmless as long as the remote cluster was a distinct physical cluster from the management cluster.

When the managed cluster is a self-managed SveltosCluster (its remote client/config resolve back to the management cluster itself), the remote-cluster cleanup pass ends up scanning the management cluster with no scoping at all, and deletes every same-GVK, same-ClusterProfile resource not present in its own (often empty, since all its policies are Local) desired state, including resources deployed by other ClusterSummary instances via Local.

Fix:

  • The clustersummary annotation is now set on every deployed resource, not only ones deployed via Local.
  • Stale-resource scanning now checks this annotation on both cleanup passes, but only as a protective signal: a resource is skipped only when it's explicitly annotated for a different ClusterSummary. A resource with no annotation at all (deployed by a version before this change) still falls through to the existing ownership/reference checks, so upgrades don't leave pre-existing resources permanently undetectable as stale.

Fixes #1891

Fixes a bug where a SveltosCluster representing the management cluster itself (self-managed) matching a
ClusterProfile could cause its ClusterSummary to delete resources deployed by other, unrelated ClusterSummary
instances.

When a PolicyRef/KustomizationRef uses deploymentType: Local, resources are deployed into the management cluster
and tagged with a projectsveltos.io/clustersummary annotation identifying the owning ClusterSummary, so stale-resource
cleanup only removes what that specific ClusterSummary deployed in the management cluster. That scoping was only ever
applied to the "clean the management cluster" pass. The "clean the remote/managed cluster" pass never set it, which was
harmless as long as the remote cluster was a distinct physical cluster from the management cluster.

When the managed cluster is a self-managed SveltosCluster (its remote client/config resolve back to the management cluster
itself), the remote-cluster cleanup pass ends up scanning the management cluster with no scoping at all, and deletes every
same-GVK, same-ClusterProfile resource not present in its own (often empty, since all its policies are Local) desired state,
including resources deployed by other ClusterSummary instances via Local.

Fix:
- The clustersummary annotation is now set on every deployed resource, not only ones deployed via Local.
- Stale-resource scanning now checks this annotation on both cleanup passes, but only as a protective signal: a resource is
skipped only when it's explicitly annotated for a different ClusterSummary. A resource with no annotation at all (deployed by
a version before this change) still falls through to the existing ownership/reference checks, so upgrades don't leave pre-existing
resources permanently undetectable as stale.
@gianlucam76
gianlucam76 merged commit f4521f5 into projectsveltos:main Jul 29, 2026
11 checks passed
@gianlucam76
gianlucam76 deleted the bug-1891 branch July 29, 2026 08:35
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.

BUG: resources not created if clusterProfile matches also mgmt cluster

1 participant