diff --git a/lib/promscrape/discovery/kubernetes/api_watcher.go b/lib/promscrape/discovery/kubernetes/api_watcher.go index d5def2f29..e6c56212b 100644 --- a/lib/promscrape/discovery/kubernetes/api_watcher.go +++ b/lib/promscrape/discovery/kubernetes/api_watcher.go @@ -437,6 +437,9 @@ func (uw *urlWatcher) registerPendingAPIWatchers() { for aw := range uw.awsPending { awsPending = append(awsPending, aw) delete(uw.awsPending, aw) + if _, ok := uw.aws[aw]; !ok { + uw.aws[aw] = struct{}{} + } } uw.reloadScrapeWorksForAPIWatchers(awsPending, uw.objectsByKey) uw.mu.Unlock()