From 13d7cee4e8ac9696e4cad0cb529674d40d2d21d6 Mon Sep 17 00:00:00 2001 From: "changyanhao.cyh" Date: Tue, 19 Mar 2024 17:13:01 +0800 Subject: [PATCH] fix(gracedelete/webhook): rewrite PodDeletionIndicationLabel value to trigger reconcile of controllers, when reuse "kubectl delete" --- pkg/webhook/server/generic/pod/gracedelete/webhook.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/webhook/server/generic/pod/gracedelete/webhook.go b/pkg/webhook/server/generic/pod/gracedelete/webhook.go index a6d9dc1e..bbaa8917 100644 --- a/pkg/webhook/server/generic/pod/gracedelete/webhook.go +++ b/pkg/webhook/server/generic/pod/gracedelete/webhook.go @@ -84,10 +84,7 @@ func (gd *GraceDelete) Validating(ctx context.Context, c client.Client, oldPod, if newPod.Labels == nil { newPod.Labels = map[string]string{} } - if _, ok := newPod.Labels[appsv1alpha1.PodDeletionIndicationLabelKey]; ok { - return nil - } - newPod.Labels[appsv1alpha1.PodDeletionIndicationLabelKey] = strconv.FormatInt(time.Now().Unix(), 10) + newPod.Labels[appsv1alpha1.PodDeletionIndicationLabelKey] = strconv.FormatInt(time.Now().UnixNano(), 10) return c.Update(ctx, newPod) })