Skip to content

parallelize InformerManager changeNamespaces#3430

Merged
csviri merged 2 commits into
operator-framework:mainfrom
TQJADE:changenamespaces-improve
Jun 19, 2026
Merged

parallelize InformerManager changeNamespaces#3430
csviri merged 2 commits into
operator-framework:mainfrom
TQJADE:changenamespaces-improve

Conversation

@TQJADE

@TQJADE TQJADE commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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
@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();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would look a bit nicer if applied :)

@csviri csviri force-pushed the changenamespaces-improve branch from 6aa69a1 to 4dddaff Compare June 19, 2026 07:49

@csviri csviri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @TQJADE ,

thank you very much for the PR, to fix the format it is enough if you run mvn clean install and push the code. Otherwise looks good to me, thank you!

Comment on lines +127 to +129
ns -> {
final InformerWrapper<R> source = createEventSourceForNamespace(ns);
source.start();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would look a bit nicer if applied :)

TQJADE added 2 commits June 19, 2026 09:30
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>
Signed-off-by: Qi Tan <16416018+TQJADE@users.noreply.github.com>
@TQJADE TQJADE force-pushed the changenamespaces-improve branch from 94cd77c to 35ef376 Compare June 19, 2026 16:31
@csviri csviri merged commit ea7176b into operator-framework:main Jun 19, 2026
27 checks passed
@csviri

csviri commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Thank you @TQJADE !

@TQJADE TQJADE deleted the changenamespaces-improve branch June 19, 2026 20:56
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.

3 participants