Skip to content

Commit df0fb87

Browse files
authored
Merge pull request #7356 from codablock/unhealthy-on-unauthorized
🐛 Don't retry health check when Unauthorized is returned
2 parents 74ff317 + 7a07b06 commit df0fb87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

controllers/remote/cluster_cache_tracker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ func (t *ClusterCacheTracker) healthCheckCluster(ctx context.Context, in *health
482482
// If no error occurs, reset the unhealthy counter.
483483
_, err := restClient.Get().AbsPath(in.path).Timeout(in.requestTimeout).DoRaw(ctx)
484484
if err != nil {
485+
if apierrors.IsUnauthorized(err) {
486+
// Unauthorized means that the underlying kubeconfig is not authorizing properly anymore, which
487+
// usually is the result of automatic kubeconfig refreshes, meaning that we have to throw away the
488+
// clusterAccessor and rely on the creation of a new one (with a refreshed kubeconfig)
489+
return false, err
490+
}
485491
unhealthyCount++
486492
} else {
487493
unhealthyCount = 0

0 commit comments

Comments
 (0)