Skip to content

CLID-638: Add ARCHITECTURE.md#1460

Open
dorzel wants to merge 1 commit into
openshift:mainfrom
dorzel:CLID-638
Open

CLID-638: Add ARCHITECTURE.md#1460
dorzel wants to merge 1 commit into
openshift:mainfrom
dorzel:CLID-638

Conversation

@dorzel

@dorzel dorzel commented Jul 1, 2026

Copy link
Copy Markdown
Member

Description

Add ARCHITECTURE.md. Tried to keep this high level and not code specific. Let me know if the "High-Level Flow" graph is helpful or not.

Github / Jira issue: https://redhat.atlassian.net/browse/CLID-638

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Expected Outcome

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive architecture guide for oc-mirror v2.
    • Described the main workflow modes, end-to-end execution flow, and how image copies are collected, filtered, batched, and processed.
    • Documented key runtime components, archive handling, local cache behavior, delete workflow steps, and generated cluster resources.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 1, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 1, 2026

Copy link
Copy Markdown

@dorzel: This pull request references CLID-638 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Description

Add ARCHITECTURE.md. Tried to keep this high level and not code specific. Let me know if the "High-Level Flow" graph is helpful or not.

Github / Jira issue: https://redhat.atlassian.net/browse/CLID-638

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Expected Outcome

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds a new ARCHITECTURE.md document describing oc-mirror v2's architecture, including workflow modes, execution flow, directory structure, executor lifecycle, collector system, core data structures, batch worker behavior, archive/history mechanism, cache registry, cluster resource generation, delete workflow, and catalog rebuilding.

Changes

Architecture documentation

Layer / File(s) Summary
High-level overview and directory layout
ARCHITECTURE.md
Documents the three workflow modes, end-to-end execution flow, and purposes of key directories/modules.
Executor lifecycle and collector system
ARCHITECTURE.md
Describes the executor's validate/complete/run phases and how collectors produce []CopyImageSchema work items via CollectAll(), along with core data structures like CopyImageSchema, CollectorSchema, and ImageSetConfiguration.
Batch worker, archive, and cache registry
ARCHITECTURE.md
Documents concurrent batch copying, error reporting, archive responsibilities with incremental history via --since, and the embedded local cache registry usage.
Cluster resource generation, delete workflow, and catalog rebuilding
ARCHITECTURE.md
Details generated Kubernetes resources for D2M/M2M, the delete sub-command's generate/execute phases, and catalog rebuilding for filtered operator catalogs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding the ARCHITECTURE.md documentation file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR only adds ARCHITECTURE.md docs; no Ginkgo tests or test titles were changed, so the naming rule is not implicated.
Test Structure And Quality ✅ Passed PR changes only ARCHITECTURE.md; no Ginkgo test files or test code were modified, so this check is not applicable.
Microshift Test Compatibility ✅ Passed Doc-only PR adds ARCHITECTURE.md; no new Ginkgo e2e tests or MicroShift-sensitive APIs were introduced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only adds ARCHITECTURE.md documentation; no new Ginkgo e2e tests or SNO-sensitive test logic were added.
Topology-Aware Scheduling Compatibility ✅ Passed Doc-only ARCHITECTURE.md change; no manifests, controllers, or scheduling code were modified.
Ote Binary Stdout Contract ✅ Passed Docs-only PR (ARCHITECTURE.md); no process-level code changes that could write stdout from OTE binaries.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR only adds ARCHITECTURE.md; it contains no Ginkgo e2e tests or IPv4/external-network assumptions, so the check is not applicable.
No-Weak-Crypto ✅ Passed ARCHITECTURE.md is docs-only and contains no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparison code.
Container-Privileges ✅ Passed PR adds only ARCHITECTURE.md; no K8s/container manifest changes or privilege settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The change is a docs-only ARCHITECTURE.md, and it contains no log statements or sensitive data markers (passwords, tokens, PII, hostnames).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot requested review from aguidirh and r4f4 July 1, 2026 19:36
@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dorzel
Once this PR has been reviewed and has the lgtm label, please assign aguidirh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ARCHITECTURE.md`:
- Around line 77-82: The `CopyImageSchema` summary in `ARCHITECTURE.md` is
missing the `RebuiltTag` field, so update the contract description to include it
alongside `Source`, `Destination`, `Origin`, and `Type`. Use the
`CopyImageSchema` symbol as the anchor and add a brief note that `RebuiltTag`
identifies rebuilt catalogs in the rebuild flow, keeping the `CollectorSchema`
description unchanged.
- Around line 17-41: The flowchart fence in ARCHITECTURE.md is missing a
language label, which triggers MD040. Update the existing diagram block to use a
fenced language tag such as text (or convert the diagram to Mermaid) so the
intent stays explicit and lint-clean; keep the change localized to the flowchart
section and preserve the current diagram content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: daf06a28-da28-40a8-be83-52197636df02

📥 Commits

Reviewing files that changed from the base of the PR and between c3552e2 and 8aa2d1b.

📒 Files selected for processing (1)
  • ARCHITECTURE.md

Comment thread ARCHITECTURE.md
Comment on lines +17 to +41
```
ImageSetConfiguration (YAML)
|
Read config
|
Initialize <- determine workflow mode, set up modules
|
Start execution <- start local cache registry, dispatch to workflow
|
+--- Mirror to Disk / Disk to Mirror / Mirror to Mirror
|
Collect all images
| | | |
Release Op Add Helm <- each produces []CopyImageSchema
| | | |
+----+----+----+
|
Exclude blocked + deduplicate
|
Rebuild catalogs <- M2D and M2M only
|
Batch worker <- concurrent image copy
|
Build archive (M2D) / Cluster resources generation (D2M, M2M)
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Label the flowchart fence.

This block trips MD040 as written. Use text (or convert it to Mermaid) so the diagram stays lint-clean and its intent is explicit.

Suggested fix
-```
+```text

As per the MD040 warning, fenced code blocks need a language tag.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
ImageSetConfiguration (YAML)
|
Read config
|
Initialize <- determine workflow mode, set up modules
|
Start execution <- start local cache registry, dispatch to workflow
|
+--- Mirror to Disk / Disk to Mirror / Mirror to Mirror
|
Collect all images
| | | |
Release Op Add Helm <- each produces []CopyImageSchema
| | | |
+----+----+----+
|
Exclude blocked + deduplicate
|
Rebuild catalogs <- M2D and M2M only
|
Batch worker <- concurrent image copy
|
Build archive (M2D) / Cluster resources generation (D2M, M2M)
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 17-17: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 17 - 41, The flowchart fence in ARCHITECTURE.md
is missing a language label, which triggers MD040. Update the existing diagram
block to use a fenced language tag such as text (or convert the diagram to
Mermaid) so the intent stays explicit and lint-clean; keep the change localized
to the flowchart section and preserve the current diagram content.

Source: Linters/SAST tools

Comment thread ARCHITECTURE.md
Comment on lines +77 to +82
**CopyImageSchema** (`internal/pkg/api/v2alpha1`) -- the central unit of work representing one image to copy:
- `Source` / `Destination` -- full image references with transport prefix
- `Origin` -- original image reference for tracking
- `Type` -- an `ImageType` enum classifying the image (e.g., `TypeOCPRelease`, `TypeOperatorCatalog`, `TypeGeneric`)

**CollectorSchema** -- aggregated output from all collectors, carrying the total image counts, the full `[]CopyImageSchema` list, and operator-specific mappings.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Add RebuiltTag to CopyImageSchema.

The schema summary omits RebuiltTag, which is part of the actual CopyImageSchema contract and is used to identify rebuilt catalogs in the rebuild flow.

Suggested fix
 - `Type` -- an `ImageType` enum classifying the image (e.g., `TypeOCPRelease`, `TypeOperatorCatalog`, `TypeGeneric`)
+- `RebuiltTag` -- marks rebuilt catalogs used by the catalog-rebuild flow

As per the provided internal/pkg/api/v2alpha1/type_internal.go snippet, this field exists on the real struct.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**CopyImageSchema** (`internal/pkg/api/v2alpha1`) -- the central unit of work representing one image to copy:
- `Source` / `Destination` -- full image references with transport prefix
- `Origin` -- original image reference for tracking
- `Type` -- an `ImageType` enum classifying the image (e.g., `TypeOCPRelease`, `TypeOperatorCatalog`, `TypeGeneric`)
**CollectorSchema** -- aggregated output from all collectors, carrying the total image counts, the full `[]CopyImageSchema` list, and operator-specific mappings.
**CopyImageSchema** (`internal/pkg/api/v2alpha1`) -- the central unit of work representing one image to copy:
- `Source` / `Destination` -- full image references with transport prefix
- `Origin` -- original image reference for tracking
- `Type` -- an `ImageType` enum classifying the image (e.g., `TypeOCPRelease`, `TypeOperatorCatalog`, `TypeGeneric`)
- `RebuiltTag` -- marks rebuilt catalogs used by the catalog-rebuild flow
**CollectorSchema** -- aggregated output from all collectors, carrying the total image counts, the full `[]CopyImageSchema` list, and operator-specific mappings.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 77 - 82, The `CopyImageSchema` summary in
`ARCHITECTURE.md` is missing the `RebuiltTag` field, so update the contract
description to include it alongside `Source`, `Destination`, `Origin`, and
`Type`. Use the `CopyImageSchema` symbol as the anchor and add a brief note that
`RebuiltTag` identifies rebuilt catalogs in the rebuild flow, keeping the
`CollectorSchema` description unchanged.

@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown

@dorzel: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants