From 98ae80207f5e31ec05e82bde279dbbd8b2fd0b11 Mon Sep 17 00:00:00 2001 From: linruichao Date: Mon, 14 Dec 2020 15:02:30 +0800 Subject: [PATCH] fixed: check the cluster has initialized Previously, always check whether the cluster has been initialized, but the updateClusterCondition function always removes the old condition and then adds the new condition, resulting in always returning after updating the initialized condition. This commit check the cluster has initialized, if initialized will not updated condition Signed-off-by: linruichao --- pkg/controller/cluster/cluster_controller.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/controller/cluster/cluster_controller.go b/pkg/controller/cluster/cluster_controller.go index eb5b31aa..c3c17919 100644 --- a/pkg/controller/cluster/cluster_controller.go +++ b/pkg/controller/cluster/cluster_controller.go @@ -538,7 +538,10 @@ func (c *clusterController) syncCluster(key string) error { LastUpdateTime: metav1.Now(), LastTransitionTime: metav1.Now(), } - c.updateClusterCondition(cluster, initializedCondition) + + if !isConditionTrue(cluster, clusterv1alpha1.ClusterInitialized) { + c.updateClusterCondition(cluster, initializedCondition) + } if !reflect.DeepEqual(oldCluster, cluster) { cluster, err = c.clusterClient.Update(cluster) @@ -546,7 +549,6 @@ func (c *clusterController) syncCluster(key string) error { klog.Errorf("Error updating cluster %s, error %s", cluster.Name, err) return err } - return nil } } -- GitLab