Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

OchiengEd
Copy link
Contributor

@OchiengEd OchiengEd commented May 15, 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 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 owner May 15, 2025 17:23
Copy link

netlify bot commented May 15, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 02f39cc
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6865462add8e2f0008c3a386
😎 Deploy Preview https://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.

@openshift-ci openshift-ci bot requested review from camilamacedo86 and trgeiger May 15, 2025 17:23
Copy link

codecov bot commented May 15, 2025

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 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/shared/util/image/cache.go 70.58% 10 Missing and 5 partials ⚠️
internal/shared/util/image/helm.go 89.32% 7 Missing and 4 partials ⚠️
internal/operator-controller/applier/helm.go 22.22% 6 Missing and 1 partial ⚠️
internal/shared/util/image/pull.go 40.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     
Flag Coverage Δ
e2e 43.12% <3.57%> (-0.94%) ⬇️
experimental-e2e 49.19% <13.09%> (-0.90%) ⬇️
unit 60.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.

@OchiengEd OchiengEd force-pushed the helm_explorations branch from 3b36dfb to 272dcbf Compare May 15, 2025 17:40
@OchiengEd OchiengEd force-pushed the helm_explorations branch from 272dcbf to 39948a0 Compare May 21, 2025 15:51
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

OH. Great work 🥇

@OchiengEd OchiengEd force-pushed the helm_explorations branch 4 times, most recently from 6dfc6c0 to 059008d Compare June 3, 2025 18:04
@OchiengEd
Copy link
Contributor Author

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
if layer.MediaType == registry.ProvLayerMediaType {
continue
}

@OchiengEd OchiengEd force-pushed the helm_explorations branch 2 times, most recently from 797bddb to 85f9e44 Compare June 3, 2025 20:32
@OchiengEd OchiengEd force-pushed the helm_explorations branch from 036e4c8 to 0dfea34 Compare June 13, 2025 01:26
@@ -209,6 +211,17 @@ func (h *Helm) buildHelmChart(bundleFS fs.FS, ext *ocv1.ClusterExtension) (*char
if err != nil {
return nil, err
}
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We've been trying to put the feature checks in main. Wdyt about refactoring to have another implementation of the BundleToHelmChart converter that accepts chart bundles, or maybe that can route between different bundle types? Then if the feature gate is enabled, use that one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not have any concerns with having feature checks in main. I think that would be the ideal scenario as it would allow for feature-gated functionality to be tested at build time.

Trying to look at the issue from afar, our challenge in this case is we are trying to run tests on a feature gated function, pullChart() while we are not allowing a portion of the code in the cache's Store() method not to run since the feature gate is not enabled. The big question therefore is how do we navigate this quandary?

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not have any concerns with having feature checks in main. I think that would be the ideal scenario as it would allow for feature-gated functionality to be tested at build time.

We are working towards to it
See; #1980

We will use the experimental CRD and have all feature flags enabled for our e2e tests.

@OchiengEd OchiengEd force-pushed the helm_explorations branch 2 times, most recently from fb98756 to 78069c9 Compare June 17, 2025 21:06
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
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
Contributor Author

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
Contributor

@camilamacedo86 camilamacedo86 left a comment

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-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2025
@camilamacedo86
Copy link
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
Contributor

tmshort commented Jul 1, 2025

@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

@OchiengEd OchiengEd force-pushed the helm_explorations branch from 46af89e to c6c3ca8 Compare July 1, 2025 22:05
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 1, 2025
Copy link

openshift-ci bot commented Jul 1, 2025

New changes are detected. LGTM label has been removed.

OchiengEd added 3 commits July 2, 2025 09:35
* 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 <[email protected]>
Signed-off-by: Edmund Ochieng <[email protected]>
@OchiengEd OchiengEd force-pushed the helm_explorations branch from c6c3ca8 to 02f39cc Compare July 2, 2025 14:45
@OchiengEd
Copy link
Contributor Author

@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
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
Contributor Author

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.

@tmshort
Copy link
Contributor

tmshort commented Jul 2, 2025

The changes to the manifests look good!

@tmshort
Copy link
Contributor

tmshort commented Jul 2, 2025

/approve

Copy link

openshift-ci bot commented Jul 2, 2025

[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

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants