From 0417c27cd26a44694ec45e715d7e1b1c69a002bd Mon Sep 17 00:00:00 2001 From: fox Date: Thu, 6 Jan 2022 14:06:34 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#879=20Statefulset=20should=20consider=20?= =?UTF-8?q?non-available=20pods=20when=20deleting=E2=80=A6=20(#880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #879 Statefulset should consider non-available pods when deleting pods * fix #879 Statefulset should consider non-available pods when deleting pods --- pkg/controller/statefulset/stateful_set_control.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controller/statefulset/stateful_set_control.go b/pkg/controller/statefulset/stateful_set_control.go index 9a76409ce3..c46a531b0b 100644 --- a/pkg/controller/statefulset/stateful_set_control.go +++ b/pkg/controller/statefulset/stateful_set_control.go @@ -581,12 +581,15 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet( continue } // if we are in monotonic mode and the condemned target is not the first unhealthy Pod block - if !isRunningAndReady(condemned[target]) && monotonic && condemned[target] != firstUnhealthyPod { + if avail, waitTime := isRunningAndAvailable(condemned[target], minReadySeconds); !avail && monotonic && condemned[target] != firstUnhealthyPod { klog.V(4).Infof( - "StatefulSet %s/%s is waiting for Pod %s to be Running and Ready prior to scale down", + "StatefulSet %s/%s is waiting for Pod %s to be Running and Available prior to scale down", set.Namespace, set.Name, firstUnhealthyPod.Name) + if waitTime > 0 { + durationStore.Push(getStatefulSetKey(condemned[target]), waitTime) + } return &status, nil } klog.V(2).Infof("StatefulSet %s/%s terminating Pod %s for scale down",