Skip to content

Commit cae57ec

Browse files
authored
Merge pull request #8158 from k8s-infra-cherrypick-robot/cherry-pick-8122-to-release-1.3
[release-1.3] 🐛 Requeue health check during the creation of a new cluster accessor
2 parents 1bde907 + bf05b5a commit cae57ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

controllers/remote/cluster_cache_tracker.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ func (t *ClusterCacheTracker) healthCheckCluster(ctx context.Context, in *health
528528
}
529529

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

0 commit comments

Comments
 (0)