linkerd2/multicluster/service-mirror
Alejandro Pedraza 7b2b01d539
Unregister prom gauges when recycling cluster watcher (#11875)
Unregister prom gauges when recycling cluster watcher

Fixes #11839

When in `restartClusterWatcher` we fail to connect to the target cluster
for whatever reason, the function gets called again 10s later, and tries
to register the same prometheus metrics without unregistering them
first, which generates warnings.

The problem lies in `NewRemoteClusterServiceWatcher`, which instantiates
the remote kube-api client and registers the metrics, returning a nil
object if the client can't connect. `cleanupWorkers` at the beginning of
`restartClusterWatcher` won't unregister those metrics because of that
nil object.

To fix this, gauges are unregistered on error.
2024-01-05 18:07:13 -08:00
..
cluster_watcher.go Unregister prom gauges when recycling cluster watcher (#11875) 2024-01-05 18:07:13 -08:00
cluster_watcher_headless.go Removed dupe imports (#10049) 2023-01-10 14:34:56 -05:00
cluster_watcher_mirroring_test.go Fix mirroring all services when remote selector is empty (#11344) 2023-09-07 17:39:17 +01:00
cluster_watcher_test_util.go Fix mirroring all services when remote selector is empty (#11344) 2023-09-07 17:39:17 +01:00
events_formatting.go multicluster: Fix metadata prefix matching (#7825) 2022-02-07 19:16:43 -08:00
jittered_ticker.go Add `gosec` and `errcheck` lints (#7954) 2022-03-03 10:09:51 -07:00
metrics.go Allow clusters to be linked without a gateway (#11226) 2023-08-15 12:12:37 -07:00
probe_worker.go Allow clusters to be linked without a gateway (#11226) 2023-08-15 12:12:37 -07:00