Skip to content

Commit 942c258

Browse files
committed
controller: consider StatefulSet's ordinals
Signed-off-by: zhangzujian <[email protected]>
1 parent 61ae787 commit 942c258

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dist/images/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-monitor && \
2222
setcap CAP_NET_RAW,CAP_NET_BIND_SERVICE+eip /kube-ovn/kube-ovn-controller && \
2323
setcap CAP_NET_ADMIN,CAP_NET_RAW,CAP_NET_BIND_SERVICE,CAP_SYS_ADMIN+eip /kube-ovn/kube-ovn-daemon
2424

25-
FROM kubeovn/kube-ovn-base:$BASE_TAG
25+
FROM kubeovn/kube-ovn-base:$BASE_TAG-amd64
2626

2727
COPY --chmod=0644 logrotate/* /etc/logrotate.d/
2828
COPY grace_stop_ovn_controller /usr/share/ovn/scripts/grace_stop_ovn_controller

pkg/controller/pod.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,11 @@ func isStatefulSetPodToDel(c kubernetes.Interface, pod *v1.Pod, statefulSetName
12671267
return false
12681268
}
12691269
// down scaled
1270-
if index >= int64(*sts.Spec.Replicas) {
1270+
var ordinalsStart int64
1271+
if sts.Spec.Ordinals != nil {
1272+
ordinalsStart = int64(sts.Spec.Ordinals.Start)
1273+
}
1274+
if index >= ordinalsStart+int64(*sts.Spec.Replicas) {
12711275
klog.Infof("statefulset %s is down scaled", statefulSetName)
12721276
return true
12731277
}

0 commit comments

Comments
 (0)