Skip to content

feat: add ocm component for zot#73

Open
olzemal wants to merge 2 commits into
mainfrom
feature/add-zot-component
Open

feat: add ocm component for zot#73
olzemal wants to merge 2 commits into
mainfrom
feature/add-zot-component

Conversation

@olzemal
Copy link
Copy Markdown
Contributor

@olzemal olzemal commented May 22, 2026

What

Add OCM component for zot.

Why

To enable teams to host their own instances of zot.

Testing

# setup cluster with zot registry
kind create cluster
helm repo add project-zot http://zotregistry.dev/helm-charts && helm repo update
helm install zot project-zot/zot -n zot --create-namespace

# create ctf
cd zot/
ocm add componentversion --version 0.1.0 --create --file ./ctf component-constructor.yaml

# upload ctf
NODEPORT=$(kubectl get svc -n zot zot -ojsonpath='{.spec.ports[0].nodePort}')
kubectl port-forward -n zot svc/zot $NODEPORT:5000 &
ocm transfer ctf --copy-resources ./ctf http://localhost:$NODEPORT/odc

# validate values template
ocm-kit http://localhost:$NODEPORT/odc//opendefense.cloud/zot:0.1.0 > zot-values.yaml

# install zot
helm upgrade --install -n zot2 --create-namespace zot oci://localhost:$NODEPORT/odc/project-zot/helm-charts/zot:0.1.116 --values zot-values.yaml

# validate images get pulled from local zot
kubectl get pod -n zot2 -oyaml | yq '.items[].spec.containers[].image'

Notes for reviewers

Checklist

  • Tests added/updated
  • No breaking changes (or upgrade path documented above)
  • Readable commit history (squashed and cleaned up as desired)
  • AI code review considered and comments resolved

Summary by CodeRabbit

  • Documentation

    • Added OCM packaging layout docs describing component structure and template usage.
  • Configuration

    • Introduced a zot component manifest with a Helm chart, a Helm values template and two OCI image references for deployment.
    • Updated the Flux Helm chart dependency to version 2.18.3 and aligned the corresponding values template version.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@olzemal has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 51 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 502fd724-2a14-4ee1-9fde-8557d5390b3f

📥 Commits

Reviewing files that changed from the base of the PR and between 00b49aa and fbaba05.

📒 Files selected for processing (4)
  • flux/component-constructor.yaml
  • flux/values.yaml.tpl
  • zot/component-constructor.yaml
  • zot/values.yaml.tpl
📝 Walkthrough

Walkthrough

Adds OCM packaging for zot: a component manifest with Helm chart and OCI images, a values template that resolves image references from OCIResources, a README documenting the layout, and a Flux chart version bump to 2.18.3.

Changes

zot OCM Packaging

Layer / File(s) Summary
OCM Component Definition
zot/component-constructor.yaml
Component manifest for opendefense.cloud/zot declares zot-chart Helm chart (v0.1.116), flux-chart-values-template scoped to that chart, and external OCI images (zot-image v2.1.17, alpine-image 3.18).
Template Image Configuration
zot/values.yaml.tpl
Template extracts .OCIResources (zot-image, alpine-image) and renders image and test.image fields with repository and tag values (alpine tag quoted, zot tag unquoted).
OCM Packaging Workflow Documentation
zot/README.md
Documents the zot OCM component layout and included files (component descriptor and values.yaml.tpl for ocm-kit).
Flux chart version bump
flux/component-constructor.yaml
Bumps flux-chart and flux-chart-values-template dependency versions to 2.18.3 and aligns the chart imageReference accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • yocaba

Poem

🐰 I stitched a zot package neat and bright,
templates and charts tucked snug at night,
images whispered tags in place,
README lights the packaging trace,
away the CTF sails, registry-bound delight! 📦✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add ocm component for zot' directly reflects the main changeset, which adds OCM component configuration files for the zot registry across three new files and one update.
Description check ✅ Passed The PR description covers all critical template sections: 'What' clearly states the purpose, 'Why' explains the motivation, 'Testing' provides comprehensive steps with commands, and the checklist is mostly completed with breaking changes verified.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-zot-component

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@zot/README.md`:
- Around line 27-34: Update the example invocations of the ocm CLI in the README
where the command "ocm transfer ctf" is shown: replace the incorrect flag
"--copy-local-resources" with the correct "--copy-resources" so the examples
(both the ghcr.io and localhost:5001 cases) will actually copy resources and
rewrite image references; ensure both occurrences in the "ocm transfer ctf"
examples are updated and the explanatory sentence about rewriting image
references still matches the corrected flag name.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c5fdaf7-31c2-4c53-8ee2-4b5766e562b4

📥 Commits

Reviewing files that changed from the base of the PR and between bd23ffb and 9b2179d.

📒 Files selected for processing (3)
  • zot/README.md
  • zot/component-constructor.yaml
  • zot/values.yaml.tpl

Comment thread zot/README.md Outdated
@olzemal olzemal force-pushed the feature/add-zot-component branch from 9b2179d to 63a410d Compare May 22, 2026 09:28
Comment thread zot/component-constructor.yaml Outdated

- name: alpine-image
type: ociImage
version: v3.18
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.

🧐 I guess the v is obsolete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point, for some reason i had issues leaving it out and thought ocm required versions to start with v

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
zot/component-constructor.yaml (1)

32-38: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Version format is inconsistent with the rest of the file.

Line 34 uses an unquoted version string with a v prefix (v2.1.17), while all other version fields in this file use quoted strings without the v prefix (e.g., "0.1.116", "3.18"). For consistency and to align with established patterns in this codebase, quote the version and consider removing the v prefix.

🔧 Proposed fix
       - name: zot-image
         type: ociImage
-        version: v2.1.17
+        version: "2.1.17"
         relation: external
         access:
           type: ociArtifact
-          imageReference: ghcr.io/project-zot/zot:v2.1.17
+          imageReference: ghcr.io/project-zot/zot:2.1.17
🤖 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 `@zot/component-constructor.yaml` around lines 32 - 38, Update the zot-image
component's version field to match the project's version format by quoting the
version string and removing the leading "v" (i.e., change the unquoted
v-prefixed value in the version key for component name "zot-image" to a quoted
numeric string like "2.1.17"), and make the corresponding change in
access.imageReference so the tag there also uses the same non‑v, quoted version
(e.g., ghcr.io/project-zot/zot:2.1.17) to keep fields consistent.
🧹 Nitpick comments (1)
zot/values.yaml.tpl (1)

1-10: ⚡ Quick win

Consider quoting both tags for consistency and robustness.

Line 4 emits the zot tag unquoted, while line 10 quotes the alpine tag. The alpine tag must be quoted to prevent YAML parsers from treating 3.18 as a float. The zot tag (v2.1.17) doesn't strictly require quotes because it starts with a letter, but quoting both creates consistency and future-proofs the template against version format changes (e.g., if the zot version were changed to a numeric format like 2.1.17, the unquoted template would become fragile).

♻️ Proposed refactor for consistency
 {{- $zot := index .OCIResources "zot-image" }}
 image:
   repository: {{ $zot.Host }}/{{ $zot.Repository }}
-  tag: {{ $zot.Tag }}
+  tag: "{{ $zot.Tag }}"

 {{- $alpine := index .OCIResources "alpine-image" }}
 test:
   image:
     repository: {{ $alpine.Host }}/{{ $alpine.Repository }}
     tag: "{{ $alpine.Tag }}"
🤖 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 `@zot/values.yaml.tpl` around lines 1 - 10, The zot image tag is unquoted while
the alpine tag is quoted; update the template to quote the zot tag for
consistency and YAML safety by changing the tag interpolation for the $zot image
(the line that renders {{ $zot.Tag }}) to use a quoted form similar to the
alpine tag so both image tags are emitted as strings.
🤖 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.

Duplicate comments:
In `@zot/component-constructor.yaml`:
- Around line 32-38: Update the zot-image component's version field to match the
project's version format by quoting the version string and removing the leading
"v" (i.e., change the unquoted v-prefixed value in the version key for component
name "zot-image" to a quoted numeric string like "2.1.17"), and make the
corresponding change in access.imageReference so the tag there also uses the
same non‑v, quoted version (e.g., ghcr.io/project-zot/zot:2.1.17) to keep fields
consistent.

---

Nitpick comments:
In `@zot/values.yaml.tpl`:
- Around line 1-10: The zot image tag is unquoted while the alpine tag is
quoted; update the template to quote the zot tag for consistency and YAML safety
by changing the tag interpolation for the $zot image (the line that renders {{
$zot.Tag }}) to use a quoted form similar to the alpine tag so both image tags
are emitted as strings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 533c62c4-f31f-4fb0-88ff-f2cac315de72

📥 Commits

Reviewing files that changed from the base of the PR and between 9b2179d and 00b49aa.

📒 Files selected for processing (4)
  • flux/component-constructor.yaml
  • zot/README.md
  • zot/component-constructor.yaml
  • zot/values.yaml.tpl
✅ Files skipped from review due to trivial changes (2)
  • flux/component-constructor.yaml
  • zot/README.md

@olzemal olzemal force-pushed the feature/add-zot-component branch from 00b49aa to fbaba05 Compare May 22, 2026 12:06
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