Merge pull request #597 from wawa0210/fix-repeat-get-cluster-status

Delete the extra getClusterHealthStatus logic and use the wait.Poll framework directly
This commit is contained in:
karmada-bot 2021-08-12 19:19:18 +08:00 committed by GitHub
commit 3bbf63dc87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 17 deletions

View File

@ -131,13 +131,10 @@ func (c *ClusterStatusController) syncClusterStatus(cluster *v1alpha1.Cluster) (
var currentClusterStatus = v1alpha1.ClusterStatus{}
// get the health status of member cluster
online, healthy := getClusterHealthStatus(clusterClient)
var online, healthy bool
// in case of cluster offline, retry a few times to avoid network unstable problems.
// Note: retry timeout should not be too long, otherwise will block other cluster reconcile.
if !online {
err := wait.Poll(clusterStatusRetryInterval, clusterStatusRetryTimeout, func() (done bool, err error) {
err = wait.PollImmediate(clusterStatusRetryInterval, clusterStatusRetryTimeout, func() (done bool, err error) {
online, healthy = getClusterHealthStatus(clusterClient)
if !online {
return false, nil
@ -151,7 +148,6 @@ func (c *ClusterStatusController) syncClusterStatus(cluster *v1alpha1.Cluster) (
setTransitionTime(&cluster.Status, &currentClusterStatus)
return c.updateStatusIfNeeded(cluster, currentClusterStatus)
}
}
clusterVersion, err := getKubernetesVersion(clusterClient)
if err != nil {