Fix misleading logs from cluster status controller

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
RainbowMango 2021-08-16 12:09:35 +08:00
parent e8bc6afb1a
commit fc5d191ba7
1 changed files with 2 additions and 1 deletions

View File

@ -137,13 +137,14 @@ func (c *ClusterStatusController) syncClusterStatus(cluster *v1alpha1.Cluster) (
err = wait.PollImmediate(clusterStatusRetryInterval, clusterStatusRetryTimeout, func() (done bool, err error) { err = wait.PollImmediate(clusterStatusRetryInterval, clusterStatusRetryTimeout, func() (done bool, err error) {
online, healthy = getClusterHealthStatus(clusterClient) online, healthy = getClusterHealthStatus(clusterClient)
if !online { if !online {
klog.V(2).Infof("Cluster(%s) is offline.", cluster.Name)
return false, nil return false, nil
} }
klog.V(2).Infof("Cluster(%s) back to online after retry.", cluster.Name)
return true, nil return true, nil
}) })
// error indicates that retry timeout, update cluster status immediately and return. // error indicates that retry timeout, update cluster status immediately and return.
if err != nil { if err != nil {
klog.V(2).Infof("Cluster(%s) still offline after retry, ensuring offline is set.", cluster.Name)
currentClusterStatus.Conditions = generateReadyCondition(false, false) currentClusterStatus.Conditions = generateReadyCondition(false, false)
setTransitionTime(&cluster.Status, &currentClusterStatus) setTransitionTime(&cluster.Status, &currentClusterStatus)
return c.updateStatusIfNeeded(cluster, currentClusterStatus) return c.updateStatusIfNeeded(cluster, currentClusterStatus)