Skip to content

parallelize InformerManager changeNamespaces#3430

Open
TQJADE wants to merge 1 commit into
operator-framework:mainfrom
TQJADE:changenamespaces-improve
Open

parallelize InformerManager changeNamespaces#3430
TQJADE wants to merge 1 commit into
operator-framework:mainfrom
TQJADE:changenamespaces-improve

Conversation

@TQJADE

@TQJADE TQJADE commented Jun 18, 2026

Copy link
Copy Markdown

InformerManager#changeNamespaces starts informers for newly added namespaces sequentially via Set#forEach. Each source.start() call blocks up to cacheSyncTimeout waiting for cache sync, so when N namespaces are added and any of them are slow or RBAC-denied the total wall-clock is O(N * cacheSyncTimeout). The Controller holds its EventProcessor stopped across this entire call, dropping watch events with "Skipping event ... because the event processor is not started" and producing multi-minute reconcile delays after dynamic namespace updates.

Align changeNamespaces with the existing parallel pattern already used by InformerManager#start (boundedExecuteAndWaitForAllToComplete on the caching executor).

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Copilot AI review requested due to automatic review settings June 18, 2026 16:47
@openshift-ci openshift-ci Bot requested review from csviri and metacosm June 18, 2026 16:47
InformerManager#changeNamespaces starts informers for newly added
namespaces sequentially via Set#forEach. Each source.start() call
blocks up to cacheSyncTimeout waiting for cache sync, so when N
namespaces are added and any of them are slow or RBAC-denied (a
common case under stopOnInformerErrorDuringStartup=false), the
total wall-clock is O(N * cacheSyncTimeout). The Controller holds
its EventProcessor stopped across this entire call, dropping watch
events with "Skipping event ... because the event processor is not
started" and producing multi-minute reconcile delays after dynamic
namespace updates.

Align changeNamespaces with the existing parallel pattern already
used by InformerManager#start (boundedExecuteAndWaitForAllToComplete
on the caching executor). Wall-clock drops from O(N * timeout) to
O(timeout). The sources map is already a ConcurrentHashMap, so no
additional synchronization is required.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Revert "178463593 test"

This reverts commit c3550e41e9bfbf3bc3619257aa0bb26ae46ac2dc.

Signed-off-by: Qi Tan <16416018+TQJADE@users.noreply.github.com>
@TQJADE TQJADE force-pushed the changenamespaces-improve branch from 11b8d70 to 6aa69a1 Compare June 18, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves dynamic namespace updates for informer-based event sources by starting informers for newly-added namespaces in parallel, matching the startup strategy already used by InformerManager#start and reducing end-to-end pauses when changeNamespaces is invoked.

Changes:

  • Parallelize informer startup for newly added namespaces in InformerManager#changeNamespaces using ExecutorServiceManager#boundedExecuteAndWaitForAllToComplete.
  • Avoid unnecessary executor work by early-returning when no new namespaces need informers started.

Comment on lines +127 to +129
ns -> {
final InformerWrapper<R> source = createEventSourceForNamespace(ns);
source.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants