diff --git a/controllers/apps/v2beta1/sync_sets.go b/controllers/apps/v2beta1/sync_sets.go index c2808e63a..8da41f39a 100644 --- a/controllers/apps/v2beta1/sync_sets.go +++ b/controllers/apps/v2beta1/sync_sets.go @@ -41,7 +41,7 @@ func (s *syncSets) reconcile(ctx context.Context, instance *appsv2beta1.EMQX, r _, _, oldStsList := getStateFulSetList(ctx, s.Client, instance) stsDiff := int32(len(oldStsList)) - *instance.Spec.RevisionHistoryLimit if stsDiff > 0 { - for i := 0; i < int(rsDiff); i++ { + for i := 0; i < int(stsDiff); i++ { sts := oldStsList[i].DeepCopy() // Avoid delete stateful set with non-zero replica counts if sts.Status.Replicas != 0 || *(sts.Spec.Replicas) != 0 || sts.Generation > sts.Status.ObservedGeneration || sts.DeletionTimestamp != nil { diff --git a/controllers/apps/v2beta1/sync_sets_suite_test.go b/controllers/apps/v2beta1/sync_sets_suite_test.go index 6cc97a51b..9689bf7cb 100644 --- a/controllers/apps/v2beta1/sync_sets_suite_test.go +++ b/controllers/apps/v2beta1/sync_sets_suite_test.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -var _ = Describe("Check sync rs", func() { +var _ = Describe("Check sync sts and pvc", func() { var s *syncSets var instance *appsv2beta1.EMQX = new(appsv2beta1.EMQX)