Merge pull request #95632 from mrkm4ntr/remove-redundant-variable

Remove redundant variable
This commit is contained in:
Kubernetes Prow Robot 2020-10-22 22:16:48 -07:00 committed by GitHub
commit 153d33091b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,6 @@ limitations under the License.
package statefulset package statefulset
import ( import (
"math"
"sort" "sort"
apps "k8s.io/api/apps/v1" apps "k8s.io/api/apps/v1"
@ -299,7 +298,6 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
// slice that will contain all Pods such that set.Spec.Replicas <= getOrdinal(pod) // slice that will contain all Pods such that set.Spec.Replicas <= getOrdinal(pod)
condemned := make([]*v1.Pod, 0, len(pods)) condemned := make([]*v1.Pod, 0, len(pods))
unhealthy := 0 unhealthy := 0
firstUnhealthyOrdinal := math.MaxInt32
var firstUnhealthyPod *v1.Pod var firstUnhealthyPod *v1.Pod
// First we partition pods into two lists valid replicas and condemned Pods // First we partition pods into two lists valid replicas and condemned Pods
@ -351,8 +349,7 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
for i := range replicas { for i := range replicas {
if !isHealthy(replicas[i]) { if !isHealthy(replicas[i]) {
unhealthy++ unhealthy++
if ord := getOrdinal(replicas[i]); ord < firstUnhealthyOrdinal { if firstUnhealthyPod == nil {
firstUnhealthyOrdinal = ord
firstUnhealthyPod = replicas[i] firstUnhealthyPod = replicas[i]
} }
} }
@ -361,8 +358,7 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
for i := range condemned { for i := range condemned {
if !isHealthy(condemned[i]) { if !isHealthy(condemned[i]) {
unhealthy++ unhealthy++
if ord := getOrdinal(condemned[i]); ord < firstUnhealthyOrdinal { if firstUnhealthyPod == nil {
firstUnhealthyOrdinal = ord
firstUnhealthyPod = condemned[i] firstUnhealthyPod = condemned[i]
} }
} }