Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions pkg/lib/queueinformer/queueinformer_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ func (o *operator) processNextWorkItem(ctx context.Context, loop *QueueInformer)

logger = logger.WithField("cache-key", key)

if !ok {
// we should really only (sync) resource event items
// otherwise we run the risk of processing the same object concurrently across the number of workers.
// As is, at least, the case for the namespace resolution informer,
// the namespace name gets added to the queue (e.g. nsResolveQueue.Add(obj.GetNamespace())),
// but the QueueInformer's Enqueue method always adds ResourceEvents.
queue.Add(kubestate.NewResourceEvent(kubestate.ResourceUpdated, key))
return true
}

var resource interface{}
if loop.indexer == nil {
resource = event.Resource()
Expand All @@ -305,11 +315,7 @@ func (o *operator) processNextWorkItem(ctx context.Context, loop *QueueInformer)
}
}

if !ok {
event = kubestate.NewResourceEvent(kubestate.ResourceUpdated, resource)
} else {
event = kubestate.NewResourceEvent(event.Type(), resource)
}
event = kubestate.NewResourceEvent(event.Type(), resource)
}

// Sync and requeue on error (throw out failed deletion syncs)
Expand Down
Loading