Skip to content

Commit

Permalink
controller: consider StatefulSet's ordinals
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Feb 6, 2025
1 parent 61ae787 commit d26bafb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,11 @@ func isStatefulSetPodToDel(c kubernetes.Interface, pod *v1.Pod, statefulSetName
return false
}
// down scaled
if index >= int64(*sts.Spec.Replicas) {
var ordinalsStart int64
if sts.Spec.Ordinals != nil {
ordinalsStart = int64(sts.Spec.Ordinals.Start)
}
if index >= ordinalsStart+int64(*sts.Spec.Replicas) {
klog.Infof("statefulset %s is down scaled", statefulSetName)
return true
}
Expand Down

0 comments on commit d26bafb

Please sign in to comment.