Skip to content

refactor: decompose base image watcher into archetypes - #22825

Draft
ebensh wants to merge 1 commit into
worker-archetypes-foundationfrom
worker-archetypes-batch-3
Draft

ebensh wants to merge 1 commit into
worker-archetypes-foundationfrom
worker-archetypes-batch-3

Conversation

@ebensh

@ebensh ebensh commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Decomposes the monolithic base image watcher into two worker archetypes:

  • PeriodicWorker "base-image-scheduler" — scheduling heartbeat that lists repos, claims due ones via CAS, and enqueues them. Crash recovery (failInFlightScans) runs once on first pass via sync.Once.
  • QueueConsumer "base-image-scanner" — drains claimed repos with bounded concurrency, replacing the manual semaphore + WaitGroup + goroutine spawning.

The channel between scheduler and scanner makes the producer/consumer relationship explicit. Removes manual concurrency.Stopper, semaphore.Weighted, and sync.WaitGroup.

Both workers are registered with backgroundworker.Global for /debug/workers visibility.

Depends on #22823 (foundation).

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

How I validated my change

  • go test ./central/baseimage/watcher/... passes
  • go build ./central/baseimage/watcher/... passes

🤖 Generated with Claude Code

https://claude.ai/code/session_01W7RzcPcJyXMZUqeSXfqTZQ

@openshift-ci

openshift-ci Bot commented Sep 14, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit 6b37cea. To use with deploy scripts:

export MAIN_IMAGE_TAG=5.0.x-198-g6b37cea837

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.58%. Comparing base (44a57aa) to head (6b37cea).

Additional details and impacted files
@@                       Coverage Diff                        @@
##           worker-archetypes-foundation   #22825      +/-   ##
================================================================
- Coverage                         51.83%   51.58%   -0.25%     
================================================================
  Files                              2906     2892      -14     
  Lines                            182990   181836    -1154     
================================================================
- Hits                              94858    93808    -1050     
+ Misses                            79822    79819       -3     
+ Partials                           8310     8209     -101     
Flag Coverage Δ
go-unit-tests 51.58% <100.00%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Split the monolithic watcher into two archetypes:
- PeriodicWorker 'base-image-scheduler' handles the scheduling heartbeat
  (list repos, claim due ones, enqueue). Crash recovery runs once on first
  pass via sync.Once.
- QueueConsumer 'base-image-scanner' drains claimed repos with bounded
  concurrency, replacing the manual semaphore + WaitGroup + goroutine
  spawning.

Removes: concurrency.Stopper, sync.Once start/stop guards, semaphore,
WaitGroup. The channel between scheduler and scanner makes the
producer/consumer relationship explicit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W7RzcPcJyXMZUqeSXfqTZQ
@ebensh
ebensh force-pushed the worker-archetypes-batch-3 branch from 6207c28 to 6b37cea Compare September 15, 2026 13:54
@ebensh
ebensh force-pushed the worker-archetypes-foundation branch from 72e18f8 to 44a57aa Compare September 15, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant