Skip to content

Commit

Permalink
fix #879 Statefulset should consider non-available pods when deleting…
Browse files Browse the repository at this point in the history
… pods

Signed-off-by: 孤月 <guyue.hzy@alibaba-inc.com>
  • Loading branch information
hzyfox committed Jan 6, 2022
1 parent a25326a commit 33c2c4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/controller/statefulset/stateful_set_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 avail, _ := isRunningAndAvailable(condemned[target], minReadySeconds); !avail && 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 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",
Expand Down

0 comments on commit 33c2c4e

Please sign in to comment.