Skip to content

Commit

Permalink
Merge pull request #8158 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…8122-to-release-1.3

[release-1.3] 🐛 Requeue health check during the creation of a new cluster accessor
  • Loading branch information
k8s-ci-robot authored Feb 23, 2023
2 parents 1bde907 + bf05b5a commit cae57ec
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/remote/cluster_cache_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,13 @@ func (t *ClusterCacheTracker) healthCheckCluster(ctx context.Context, in *health
}

if _, ok := t.loadAccessor(in.cluster); !ok {
// If there is no accessor but the cluster is locked, we're probably in the middle of the cluster accessor
// creation and we should requeue the health check until it's done.
if ok := t.clusterLock.TryLock(in.cluster); !ok {
t.log.V(4).Info("Waiting for cluster to be unlocked. Requeuing health check")
return false, nil
}
t.clusterLock.Unlock(in.cluster)
// Cache for this cluster has already been cleaned up.
// Nothing to do, so return true.
return true, nil
Expand Down

0 comments on commit cae57ec

Please sign in to comment.