From e25ff463bacb8f7eff5fcf063a1f1def6e7e0559 Mon Sep 17 00:00:00 2001 From: daihao Date: Sat, 11 May 2019 16:01:39 +0800 Subject: [PATCH] fix daemon set rolling update hang --- pkg/controller/daemon/daemon_controller.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/controller/daemon/daemon_controller.go b/pkg/controller/daemon/daemon_controller.go index 54953ebe88b..11fc71eb598 100644 --- a/pkg/controller/daemon/daemon_controller.go +++ b/pkg/controller/daemon/daemon_controller.go @@ -535,6 +535,15 @@ func (dsc *DaemonSetsController) updatePod(old, cur interface{}) { return } + if curPod.DeletionTimestamp != nil { + // when a pod is deleted gracefully its deletion timestamp is first modified to reflect a grace period, + // and after such time has passed, the kubelet actually deletes it from the store. We receive an update + // for modification of the deletion timestamp and expect an ds to create more replicas asap, not wait + // until the kubelet actually deletes the pod. + dsc.deletePod(curPod) + return + } + curControllerRef := metav1.GetControllerOf(curPod) oldControllerRef := metav1.GetControllerOf(oldPod) controllerRefChanged := !reflect.DeepEqual(curControllerRef, oldControllerRef)