Skip to content

Commit

Permalink
fix(gracedelete/webhook): rewrite PodDeletionIndicationLabel value to… (
Browse files Browse the repository at this point in the history
#167)

fix(gracedelete/webhook): rewrite PodDeletionIndicationLabel value to trigger reconcile of controllers, when reuse "kubectl delete"
  • Loading branch information
cyh-ant committed Mar 19, 2024
1 parent 8087ea2 commit abd79c5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/webhook/server/generic/pod/gracedelete/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit abd79c5

Please sign in to comment.