From 2e473f57e785c366ed60b96f421f2dc39ec9b288 Mon Sep 17 00:00:00 2001 From: renxiangyu Date: Wed, 6 Dec 2023 14:33:50 +0800 Subject: [PATCH] fix: delete daemonset's pod in vitural node Signed-off-by: renxiangyu --- .../cluster-manager/controllers/pod/root_pod_controller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go b/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go index fad5cd07c..a0a63e333 100644 --- a/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go +++ b/pkg/clustertree/cluster-manager/controllers/pod/root_pod_controller.go @@ -248,6 +248,10 @@ func (r *RootPodReconciler) SetupWithManager(mgr manager.Manager) error { return true } } + _, has := p.Annotations[utils.KosmosNodeOwnedByClusterAnnotations] + if (!p.DeletionTimestamp.IsZero()) && (strings.HasPrefix(p.Spec.NodeName, utils.KosmosNodePrefix) || has) { + return true + } return false } } @@ -805,7 +809,7 @@ func (r *RootPodReconciler) DeletePodInLeafCluster(ctx context.Context, lr *leaf leafPod := &corev1.Pod{} cleanRootPodFunc := func() error { - return DeletePodInRootCluster(ctx, rootnamespacedname, r.Client) + return DeletePodInRootCluster(ctx, rootnamespacedname, r.RootClient) } err := lr.Client.Get(ctx, rootnamespacedname, leafPod)