From b18f16375a66c9d51ef5b4ec46f87fb4698dc41f Mon Sep 17 00:00:00 2001 From: Adrian Muraru Date: Thu, 1 Jul 2021 11:10:20 +0300 Subject: [PATCH] fix issue-314 by checking zookeeperCluster resource version before updating sts ADDENDUM (#355) Fix owner-rv check by checking the existing STS object --- .../zookeepercluster/zookeepercluster_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/zookeepercluster/zookeepercluster_controller.go b/pkg/controller/zookeepercluster/zookeepercluster_controller.go index 67d4a3540..ed78a262a 100644 --- a/pkg/controller/zookeepercluster/zookeepercluster_controller.go +++ b/pkg/controller/zookeepercluster/zookeepercluster_controller.go @@ -234,8 +234,8 @@ func (r *ReconcileZookeeperCluster) reconcileStatefulSet(instance *zookeeperv1be return err } else { // check whether zookeeperCluster is updated before updating the sts - if !zookeeperClusterFresherThanSts(instance, sts) { - return fmt.Errorf("Staleness: cr.ResourceVersion %s is smaller than labeledRV %s", instance.ResourceVersion, sts.Labels["owner-rv"]) + if !zookeeperClusterFresherThanSts(instance, foundSts) { + return fmt.Errorf("Staleness: cr.ResourceVersion %s is smaller than labeledRV %s", instance.ResourceVersion, foundSts.Labels["owner-rv"]) } foundSTSSize := *foundSts.Spec.Replicas newSTSSize := *sts.Spec.Replicas