Skip to content

perf(scripts): speed up RHDH operator install using install-rhdh-catalog-source.sh (~30 min → ~2 min)#2870

Open
subhashkhileri wants to merge 4 commits into
redhat-developer:mainfrom
subhashkhileri:perf/parallel-iib-bundle-processing
Open

perf(scripts): speed up RHDH operator install using install-rhdh-catalog-source.sh (~30 min → ~2 min)#2870
subhashkhileri wants to merge 4 commits into
redhat-developer:mainfrom
subhashkhileri:perf/parallel-iib-bundle-processing

Conversation

@subhashkhileri
Copy link
Copy Markdown
Member

@subhashkhileri subhashkhileri commented May 20, 2026

JIRA : https://redhat.atlassian.net/browse/RHIDP-13676

Summary

  • Skips slow skopeo inspect (~42s/bundle) — attempts the copy directly; failed copies (~3s) are faster than successful inspects, so images that don't exist on quay are handled with minimal overhead
  • Parallel bundle processing with MAX_PARALLEL=10 (env-overridable)
  • Parallel opm render + registry setup — these two phases are independent, so they now run concurrently; bundle processing waits until both are done
  • Atomic render.yaml updates — each worker writes a per-bundle .sed file (keyed by digest, no locking needed); all replacements are applied in a single sed -f pass after all workers complete
  • --ignore-not-found replaces the check-then-delete secret pattern
  • Force OLM re-index by deleting the CatalogSource before recreating it — without this, OLM skips re-indexing when the tag is unchanged but the image digest changed (rebuilt IIB)
  • Fail loudly if any bundle fails to process (was: silent error log + continue)

Assisted-by: Claude Code

- Skips slow `skopeo inspect` (~42s/bundle) — attempts the copy directly
  instead; failed copies (~3s) are faster than successful inspects
- Processes bundles in parallel up to MAX_PARALLEL (default 10), with a
  portable kill-0 throttle loop that prunes finished PIDs each iteration
- Collects per-worker sed files and applies them in one pass after all
  bundles complete, avoiding concurrent writes to render.yaml
- Runs `opm render` and cluster registry setup in parallel since they
  are independent; waits before the bundle-processing phase begins
- Replaces check-then-delete secret pattern with --ignore-not-found
- Deletes existing CatalogSource before recreating to force OLM re-index
  when the tag is unchanged but the digest has changed (rebuilt IIB)
- Fails loudly if any bundle fails to process (was: silent error log)

Assisted-by: Claude Code
Co-Authored-By: Claude Code <noreply@anthropic.com>
@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge Bot commented May 20, 2026

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again

Grey Divider

Qodo Logo

@subhashkhileri subhashkhileri changed the title perf(scripts): parallelize IIB bundle processing (~27 min → ~5 min) perf(scripts): parallelize IIB bundle processing (~27 min → ~2 min) May 20, 2026
@subhashkhileri subhashkhileri changed the title perf(scripts): parallelize IIB bundle processing (~27 min → ~2 min) perf(scripts): parallelize IIB bundle processing (~30 min → ~2 min) May 20, 2026
@rhdh-qodo-merge
Copy link
Copy Markdown

Review Summary by Qodo

Parallelize IIB bundle processing for ~5x performance improvement

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Parallelizes bundle processing with configurable MAX_PARALLEL (default 10)
  - Uses portable kill -0 throttle loop to manage concurrent workers
  - Skips expensive skopeo inspect; attempts copy directly instead
• Runs opm render and registry setup concurrently before bundle processing
• Applies sed replacements atomically in single pass after all workers complete
• Replaces check-then-delete pattern with --ignore-not-found flag
• Forces OLM re-indexing by deleting CatalogSource before recreation
• Fails loudly on bundle processing errors instead of silent continuation
Diagram
flowchart LR
  A["Bundle Images"] --> B["Parallel Bundle Processing<br/>MAX_PARALLEL=10"]
  C["opm render"] --> D["Registry Setup"]
  C --> E["Wait for Both"]
  D --> E
  E --> B
  B --> F["Collect sed Files"]
  F --> G["Apply Atomic<br/>Replacements"]
  G --> H["Regenerate IIB"]
  H --> I["Delete & Recreate<br/>CatalogSource"]
Loading

Grey Divider

File Changes

1. .rhdh/scripts/install-rhdh-catalog-source.sh ✨ Enhancement +118/-43

Parallelize bundle processing and optimize registry operations

• Added MAX_PARALLEL environment variable (default 10) for controlling concurrent bundle processing
• Extracted bundle processing logic into new process_bundle() function that handles pull, rewrite,
 repack, and push operations
• Refactored update_refs_in_iib_bundles() to spawn parallel workers with kill -0 throttle loop
 instead of sequential processing
• Collects per-bundle sed files and applies them atomically in single pass after all workers
 complete
• Parallelized opm render and registry setup phases using background job with wait
• Replaced check-then-delete secret pattern with --ignore-not-found flag for cleaner code
• Added CatalogSource deletion before recreation to force OLM re-indexing on digest changes
• Added error handling to fail loudly when bundle processing fails

.rhdh/scripts/install-rhdh-catalog-source.sh


Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge Bot added enhancement New feature or request Other labels May 20, 2026
@subhashkhileri subhashkhileri changed the title perf(scripts): parallelize IIB bundle processing (~30 min → ~2 min) erf(scripts): speed up RHDH operator cluster install (~30 min → ~2 min) May 20, 2026
…opeo stderr

Background subshells don't inherit set -e from the parent, so
intermediate failures (umoci, skopeo push) went undetected and the
worker would write a .sed entry for a broken bundle. Also redirect
speculative copy stderr to a per-bundle file instead of /dev/null
so auth failures, timeouts, and disk errors are debuggable.

Assisted-by: Claude Code
Co-Authored-By: Claude Code <noreply@anthropic.com>
@subhashkhileri subhashkhileri changed the title erf(scripts): speed up RHDH operator cluster install (~30 min → ~2 min) perf(scripts): speed up RHDH operator cluster install (~30 min → ~2 min) May 20, 2026
@subhashkhileri subhashkhileri changed the title perf(scripts): speed up RHDH operator cluster install (~30 min → ~2 min) perf(scripts): speed up RHDH operator install using install-rhdh-catalog-source.sh (~30 min → ~2 min) May 20, 2026
Assisted-by: Claude Code
Co-Authored-By: Claude Code <noreply@anthropic.com>
Assisted-by: Claude Code
Co-Authored-By: Claude Code <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Other

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant