Merge pull request #117943 from lowang-bh/lessFunCall

improve: reduce function calling number
This commit is contained in:
Kubernetes Prow Robot
2024-10-24 04:52:52 +01:00
committed by GitHub

View File

@@ -566,8 +566,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
}
// for any empty indices in the sequence [0,set.Spec.Replicas) create a new Pod at the correct revision
for ord := getStartOrdinal(set); ord <= getEndOrdinal(set); ord++ {
replicaIdx := ord - getStartOrdinal(set)
start, end := getStartOrdinal(set), getEndOrdinal(set)
for ord := start; ord <= end; ord++ {
replicaIdx := ord - start
if replicas[replicaIdx] == nil {
replicas[replicaIdx] = newVersionedStatefulSetPod(
currentSet,