addon-controller
addon-controller copied to clipboard
BUG: Stale drift-detection pod
Problem Description
When Sveltos is instructed to deploy agents (sveltos-agent and drift-detection-manager) in the management cluster following sequence leaves a stale drift-detection-manager in the management cluster:
- create a Profile/ClusterProfile with mode set to driftDetection
- have a cluster/sveltoscluster match => drift-detection-manager is created in the management cluster
- change cluster/sveltoscluster labels so it does not match any Profile/ClusterProfile anymore
- when all ClusterSummaries instances are gone, delete the cluster/sveltosCluster => drift-detection-manager is state
Reason is the cleanup of the drift-detection-manager happens within ClusterSummary reconciler if the cluster is gone or marked for deletion. But following above sequence, ClusterSummaries are all gone when cluster is deleted, so the stale drift-detection-manager deployment in the management cluster.