Skip to content

Commit a6123dd

Browse files
committed
controller: consider StatefulSet's start ordinal (#4967)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent dbfc8a5 commit a6123dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/controller/pod.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,11 @@ func isStatefulSetPodToDel(c kubernetes.Interface, pod *v1.Pod, statefulSetName
12811281
return false
12821282
}
12831283
// down scaled
1284-
if index >= int64(*sts.Spec.Replicas) {
1284+
var startOrdinal int64
1285+
if sts.Spec.Ordinals != nil {
1286+
startOrdinal = int64(sts.Spec.Ordinals.Start)
1287+
}
1288+
if index >= startOrdinal+int64(*sts.Spec.Replicas) {
12851289
klog.Infof("statefulset %s is down scaled", statefulSetName)
12861290
return true
12871291
}

0 commit comments

Comments
 (0)