diff --git a/pkg/lib/queueinformer/queueinformer_operator.go b/pkg/lib/queueinformer/queueinformer_operator.go index 779e4093cf1..bd60c188a35 100644 --- a/pkg/lib/queueinformer/queueinformer_operator.go +++ b/pkg/lib/queueinformer/queueinformer_operator.go @@ -123,14 +123,24 @@ func (o *Operator) Run(stopc <-chan struct{}) (ready, done chan struct{}, atLeve } o.Log.Info("starting informers...") + started := make(map[cache.SharedIndexInformer]struct{}) for _, queueInformer := range o.queueInformers { - go queueInformer.informer.Run(stopc) + if _, ok := started[queueInformer.informer]; !ok { + go queueInformer.informer.Run(stopc) + } + started[queueInformer.informer] = struct{}{} } for _, informer := range o.informers { - go informer.Run(stopc) + if _, ok := started[informer]; !ok { + go informer.Run(stopc) + } + started[informer] = struct{}{} } + // Zero-out so started will be GC'd since this goroutine will live for a while + started = nil + o.Log.Info("waiting for caches to sync...") if ok := cache.WaitForCacheSync(stopc, hasSyncedCheckFns...); !ok { o.Log.Info("failed to wait for caches to sync")