Skip to content

Commit

Permalink
move the checking earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
srteam2020 committed May 10, 2021
1 parent 9c4744e commit 8e62f0a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ func (r *ReconcileZookeeperCluster) reconcileStatefulSet(instance *zookeeperv1be
} else if err != nil {
return err
} else {
// check whether zookeeperCluster is updated before updating the sts
if ! r.zookeeperClusterUpdated(instance, sts) {
return fmt.Errorf("Staleness: cr.ResourceVersion %s is smaller than labeledRV %s", instance.ResourceVersion, sts.Labels["owner-rv"])
}
foundSTSSize := *foundSts.Spec.Replicas
newSTSSize := *sts.Spec.Replicas
if newSTSSize != foundSTSSize {
Expand All @@ -254,10 +258,6 @@ func (r *ReconcileZookeeperCluster) reconcileStatefulSet(instance *zookeeperv1be
r.log.Info("Updating Cluster Size.", "New Data:", data, "Version", version)
r.zkClient.UpdateNode(path, data, version)
}
// check whether zookeeperCluster is updated before updating the sts
if ! r.zookeeperClusterUpdated(instance, sts) {
return fmt.Errorf("Staleness: cr.ResourceVersion %s is smaller than labeledRV %s", instance.ResourceVersion, sts.Labels["owner-rv"])
}
err = r.updateStatefulSet(instance, foundSts, sts)
if err != nil {
return err
Expand Down

0 comments on commit 8e62f0a

Please sign in to comment.