Skip to content

✨ Add support for deploying OCI helm charts in OLM v1 - #1971

Merged
openshift-merge-bot[bot] merged 3 commits into
operator-framework:mainfrom
OchiengEd:helm_explorations
Jul 10, 2025
Merged

✨ Add support for deploying OCI helm charts in OLM v1#1971
openshift-merge-bot[bot] merged 3 commits into
operator-framework:mainfrom
OchiengEd:helm_explorations

Conversation

@OchiengEd

@OchiengEdOchiengEd commented May 15, 2025

Copy link
Copy Markdown
Contributor
  • added support for deploying OCI helm charts which sits behind the HelmChartSupport feature gate
  • extend the Cache Store() method to allow storing of Helm charts alongside OCI images
  • inspect chart archive contents for chart contents

Description

This pull request aims to add logic to OLM v1 for handling OCI Helm chart support. We expect more work to go into this feature as further discussion on this occurs on issue #962 and the Arbitrary Configuration RFC which may inform how values.yml would be passed to Helm charts.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@OchiengEd
OchiengEd requested a review from a team as a code ownerMay 15, 2025 17:23
@netlify

netlifyBot commented May 15, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commit02f39cc
🔍 Latest deploy loghttps://app.netlify.com/projects/olmv1/deploys/6865462add8e2f0008c3a386
😎 Deploy Previewhttps://deploy-preview-1971--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecovBot commented May 15, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 78.57143% with 36 lines in your changes missing coverage. Please review.

Project coverage is 74.74%. Comparing base (22a990c) to head (02f39cc).
Report is 14 commits behind head on main.

Files with missing linesPatch %Lines
internal/shared/util/image/cache.go70.58%10 Missing and 5 partials ⚠️
internal/shared/util/image/helm.go89.32%7 Missing and 4 partials ⚠️
internal/operator-controller/applier/helm.go22.22%6 Missing and 1 partial ⚠️
internal/shared/util/image/pull.go40.00%2 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1971 +/- ##
==========================================
+ Coverage 74.66% 74.74% +0.07% 
==========================================
Files 81 82 +1 Lines 7365 7530 +165 ==========================================
+ Hits 5499 5628 +129 - Misses 1528 1553 +25 - Partials 338 349 +11 
FlagCoverage Δ
e2e43.12% <3.57%> (-0.94%)⬇️
experimental-e2e49.19% <13.09%> (-0.90%)⬇️
unit60.57% <75.00%> (+0.32%)⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment threadinternal/operator-controller/applier/helm.go Outdated
Comment threadinternal/operator-controller/applier/helm.go Outdated
Comment threadinternal/operator-controller/applier/helm.go Outdated
Comment threadinternal/operator-controller/applier/helm.go Outdated
Comment threadinternal/shared/util/image/pull.go Outdated
Comment threadinternal/operator-controller/applier/helm.go Outdated

@camilamacedo86camilamacedo86 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.

OH. Great work 🥇

Comment threadinternal/shared/util/image/helm.go Outdated
Comment threadinternal/operator-controller/applier/helm.go
Comment threadinternal/shared/util/image/helm.go
Comment threadinternal/shared/util/image/cache.go Outdated
Comment threadinternal/shared/util/image/helm.go Outdated
@OchiengEd
OchiengEdforce-pushed the helm_explorations branch 4 times, most recently from 6dfc6c0 to 059008dCompareJune 3, 2025 18:04
@OchiengEd

Copy link
Copy Markdown
ContributorAuthor

When pulling a Helm chart with a provenance file, at this time we have chosen to skip pulling the layer to the cache filesystem since we have no logic in place at this time to verify the chart integrity.

// Ignore the Helm provenance data layer
iflayer.MediaType==registry.ProvLayerMediaType {
continue
}

@OchiengEd
OchiengEdforce-pushed the helm_explorations branch 2 times, most recently from 797bddb to 85f9e44CompareJune 3, 2025 20:32
Comment threadinternal/shared/util/image/cache.go Outdated
Comment on lines +136 to +147
if layer.MediaType == registry.ChartLayerMediaType {
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) || testing.Testing() {
if err := storeChartLayer(dest, layer); err != nil {
return err
}
}
} else {
if _, err := archive.Apply(ctx, dest, layer.Reader, applyOpts...); err != nil {
return fmt.Errorf("error applying layer[%d]: %w", layer.Index, err)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I may have mentioned this elsewhere. If I did, apologies for repeating myself...

I feel like a better way of handling this would be to register handlers for media types. Then this section of the code would lookup the media type of the layer and then call whatever handler is found (or error if there isn't one).

With that setup, the registration of the helm chart media type/handler would be feature gated, but this code would not.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Code has been refactored. Hopefully I got your suggestion right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It still isn't exactly what I have in mind. What I have in mind is that ContainersImagePuller would have a new field named ImageHandlers that would represent the kinds of images that can be pulled. So we'd have an ImageHandler for registry+v1 and one for helm charts, and we would register those appliers in main.go (where the helm image applier would be registered behind a feature gate).

The ImageHandler could be an interface something like this:

typeImageHandlerinterface {
Match(ctx context.Context, img types.ImageCloser) (bool, error) // likely just needs `img.Manifest()`Apply(ctx context.Context, ownerIDstring, srcRef reference.Named, canonicalRef reference.Canonical, imgSrc types.ImageSource, cacheCache, sourceContext*types.SystemContext) (fs.FS, time.Time, error)

With that, ContainersImagePuller.applyImage could iterate the handlers looking for the first matching handler, and then call that handler's Apply method. And then the ContainersImagePuller implementation wouldn't have to concern itself with the details of every single image type we ever want to support.

Comment threadinternal/shared/util/image/cache.go Outdated
Comment threadinternal/shared/util/image/cache.go Outdated

@camilamacedo86camilamacedo86 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.

Thank you a lot for your contribution 🥇
I’m OK with the changes 👍 Well done 🎉
/lgtm

IHMO: It is an initial implementation, and as follow-up, I think we need to do:

  • Documentation (docs/draft) and a demo automated for this one
  • A discussion around the remaining caveats, particularly how we plan to store the Helm chart bundle in the catalog via OPM

Would be great to get a PTAL from or at least one of them @joelanford, @thetechnick, and @perdasilva before get this one merged.

Thank you 🙌

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2025
@camilamacedo86

Copy link
Copy Markdown
Contributor

Hi @OchiengEd,

Just to clarify:

In the F2F, we talked about using a single internal type and converting everything to it. We also discussed having only one runtime—Buxcutter. PoC: #1946

Supporting Helm fully will take time, and it is a big journey as we have been discussing. There are still open questions and blockers. If we go with this approach (internal format), we probably want OPM/OLM to support the internal type first before anything else. I created an internal Slack channel so that we can discuss all details and caveats.

I’m OK merging this since it’s behind a feature gate—safe to experiment and doesn’t break anything. But it may change later.

PS: If we get it merged, it would be great to have a small doc with automated demo steps (as done for others feature gates), so people can understand what was done and iterate

Leaving final call to @joelanford, @thetechnick, and @perdasilva. 🔨

@tmshort

Copy link
Copy Markdown
Contributor

@OchiengEd@itroyano
Regarding feature-gated APIs, you don't change any of the API files, so that makes things easier.
You need to create a kustomize component to enable this feature gate for experimental manifests/runs/testing.
For additional information:
https://github.com/operator-framework/operator-controller/blob/main/config/README.md
For an example:
https://github.com/operator-framework/operator-controller/tree/main/config/components/features/webhook-provider-certmanager
Once this is done, then your feature will be available in the make run-experimental target, and you can add e2e tests in to the test/experimental-e2e directory, which will be run via make test-experimental-e2e
https://github.com/operator-framework/operator-controller/tree/main/test/experimental-e2e

@openshift-ciopenshift-ciBot removed the lgtm Indicates that a PR is ready to be merged. label Jul 1, 2025
* added support for deploying OCI helm charts which sits behind
the HelmChartSupport feature gate
* extend the Cache Store() method to allow storing of Helm charts
* inspect chart archive contents
* added MediaType to the LayerData struct
Signed-off-by: Edmund Ochieng <ochienged@gmail.com>
Signed-off-by: Edmund Ochieng <ochienged@gmail.com>
Signed-off-by: Edmund Ochieng <ochienged@gmail.com>
@OchiengEd

Copy link
Copy Markdown
ContributorAuthor

@camilamacedo86@tmshort The documentation and feature-gated APIs concerns should be resolved. Kindly review and advice if anything else is needed at this time.

Comment on lines +16 to +30
To enable the Helm Chart support feature gate, you need to patch the `operator-controller-controller-manager` deployment in the `olmv1-system` namespace. This will add the `--feature-gates=HelmChartSupport=true` argument to the manager container.

1. **Create a patch file:**

```bash
$ kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=HelmChartSupport=true"}]'
```

2. **Wait for the controller manager pods to be ready:**

```bash
$ kubectl -n olmv1-system wait --for condition=ready pods -l control-plane=operator-controller-controller-manager
```

Once the above wait condition is met, the `HelmChartSupport` feature gate should be enabled in operator controller.

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.

There is a run-experimental make target that can be used to run this (of course it includes all other experimental features as well).
You might want to mention this alternative method.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch. Can we do a small revision after the PR is merged? I'm hesitant to add a change and kick out the one approval we have at this time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With the new run-experimental, I'm templated to say that our docs should only talk about the experimental feature set, and not get into the details of enabling/disabling individual features.

@tmshort

Copy link
Copy Markdown
Contributor

The changes to the manifests look good!

@tmshort

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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

The pull request process is described 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

@openshift-ciopenshift-ciBot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 2, 2025
@perdasilva

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2025
@openshift-merge-bot
openshift-merge-botBot merged commit 6bbf4d7 into operator-framework:mainJul 10, 2025
3 checks passed
@OchiengEd
OchiengEd deleted the helm_explorations branch July 10, 2025 15:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@OchiengEd@camilamacedo86@tmshort@perdasilva@joelanford@kevinrizza@trgeiger