Skip to content

Commit 389fe13

Browse files
fix: move unlock after read
1 parent d1481a0 commit 389fe13

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

providers/kubeconfig/provider.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ func (p *Provider) handleSecret(ctx context.Context, secret *corev1.Secret, mgr
205205
// Check if cluster exists and remove it if it does
206206
p.lock.RLock()
207207
ac, clusterExists := p.clusters[clusterName]
208+
p.lock.RUnlock()
208209
if clusterExists {
209210
if ac.Hash == hashStr {
210211
log.Info("Cluster already exists and has the same kubeconfig, skipping")
211-
p.lock.RUnlock()
212212
return nil
213213
}
214214

@@ -217,7 +217,6 @@ func (p *Provider) handleSecret(ctx context.Context, secret *corev1.Secret, mgr
217217
return fmt.Errorf("failed to remove existing cluster: %w", err)
218218
}
219219
}
220-
p.lock.RUnlock()
221220

222221
// Parse the kubeconfig
223222
restConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeconfigData)

0 commit comments

Comments
 (0)