Skip to content

Commit

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

[release-1.2] 🐛 Requeue health check during the creation of a new cluster accessor
  • Loading branch information
k8s-ci-robot authored Feb 23, 2023
2 parents 2048ff9 + 76fc65f commit 0599ce6
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 @@ -527,6 +527,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 0599ce6

Please sign in to comment.