From ee53646aa62cf83e321c798960a930167b30c8bf Mon Sep 17 00:00:00 2001 From: shiyan2016 Date: Wed, 12 Jan 2022 15:23:24 +0800 Subject: [PATCH] break the loop when we find the current revision Signed-off-by: shiyan2016 --- pkg/controller/cloneset/cloneset_controller.go | 1 + pkg/controller/statefulset/stateful_set_control.go | 1 + pkg/controller/uniteddeployment/revision.go | 1 + 3 files changed, 3 insertions(+) diff --git a/pkg/controller/cloneset/cloneset_controller.go b/pkg/controller/cloneset/cloneset_controller.go index 543cc69afc..4abdf16619 100644 --- a/pkg/controller/cloneset/cloneset_controller.go +++ b/pkg/controller/cloneset/cloneset_controller.go @@ -439,6 +439,7 @@ func (r *ReconcileCloneSet) getActiveRevisions(cs *appsv1alpha1.CloneSet, revisi for i := range revisions { if revisions[i].Name == cs.Status.CurrentRevision { currentRevision = revisions[i] + break } } diff --git a/pkg/controller/statefulset/stateful_set_control.go b/pkg/controller/statefulset/stateful_set_control.go index c46a531b0b..8ade085ba6 100644 --- a/pkg/controller/statefulset/stateful_set_control.go +++ b/pkg/controller/statefulset/stateful_set_control.go @@ -263,6 +263,7 @@ func (ssc *defaultStatefulSetControl) getStatefulSetRevisions( for i := range revisions { if revisions[i].Name == set.Status.CurrentRevision { currentRevision = revisions[i] + break } } diff --git a/pkg/controller/uniteddeployment/revision.go b/pkg/controller/uniteddeployment/revision.go index edd4787f01..a1eaf90aae 100644 --- a/pkg/controller/uniteddeployment/revision.go +++ b/pkg/controller/uniteddeployment/revision.go @@ -131,6 +131,7 @@ func (r *ReconcileUnitedDeployment) constructUnitedDeploymentRevisions(ud *appsa for i := range revisions { if revisions[i].Name == ud.Status.CurrentRevision { currentRevision = revisions[i] + break } }