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 1 commit 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 f33fe5c
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6840ac10cd529d00084bcd8e
😎 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

openshift-ci bot commented May 15, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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

Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 69.71429% with 53 lines in your changes missing coverage. Please review.

Project coverage is 69.17%. Comparing base (8f81c23) to head (f33fe5c).

Files with missing lines Patch % Lines
internal/shared/util/image/helm.go 75.75% 21 Missing and 11 partials ⚠️
internal/shared/util/image/cache.go 60.00% 8 Missing and 4 partials ⚠️
internal/operator-controller/applier/helm.go 0.00% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1971      +/-   ##
==========================================
- Coverage   69.17%   69.17%   -0.01%     
==========================================
  Files          79       80       +1     
  Lines        7037     7208     +171     
==========================================
+ Hits         4868     4986     +118     
- Misses       1887     1924      +37     
- Partials      282      298      +16     
Flag Coverage Δ
e2e 41.77% <3.42%> (-1.23%) ⬇️
unit 60.28% <69.71%> (+0.22%) ⬆️

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
Comment on lines 227 to 231
if hasChart(img) {
return pullChart(ctx, ownerID, imgSrc, canonicalRef, cache, layoutDir)
}

// Helm charts would error when getting OCI config
Copy link
Member

Choose a reason for hiding this comment

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

This tells me that our cache Store interface method is too specific. We need to make that generic enough to accommodate registry+v1 bundles and OCI helm charts as a first step, and rebase the feature-gated helm support on top.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making the Cache interface generic enough to be able to store both Helm charts and OCI images is inevitable. Will be looking at that at some point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is should be resolved. As can be seen in the code block below specifically on line 72, we are no longer using the StoreChart() method.

func pullChart(ctx context.Context, ownerID string, srcRef reference.Named, canonicalRef reference.Canonical, imgSrc types.ImageSource, imgRef types.ImageReference, cache Cache) (fs.FS, time.Time, error) {
imgDigest := canonicalRef.Digest()
raw, _, err := imgSrc.GetManifest(ctx, &imgDigest)
if err != nil {
return nil, time.Time{}, fmt.Errorf("get OCI helm chart manifest; %w", err)
}
chartManifest := ocispecv1.Manifest{}
if err := json.Unmarshal(raw, &chartManifest); err != nil {
return nil, time.Time{}, fmt.Errorf("unmarshaling chart manifest; %w", err)
}
if len(chartManifest.Layers) == 0 {
return nil, time.Time{}, fmt.Errorf("manifest has no layers; expected at least one chart layer")
}
layerIter := iter.Seq[LayerData](func(yield func(LayerData) bool) {
for i, layer := range chartManifest.Layers {
ld := LayerData{Index: i, MediaType: layer.MediaType}
if layer.MediaType == registry.ChartLayerMediaType {
var contents []byte
contents, ld.Err = os.ReadFile(filepath.Join(
imgRef.PolicyConfigurationIdentity(), "blobs",
"sha256", chartManifest.Layers[i].Digest.Encoded()),
)
ld.Reader = bytes.NewBuffer(contents)
}
// Ignore the Helm provenance data layer
if layer.MediaType == registry.ProvLayerMediaType {
continue
}
if !yield(ld) {
return
}
}
})
return cache.Store(ctx, ownerID, srcRef, canonicalRef, ocispecv1.Image{}, layerIter)
}

@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 3 times, most recently from 73f63ab to 4b69de7 Compare June 4, 2025 20:24
* 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]>
@OchiengEd OchiengEd force-pushed the helm_explorations branch from 4b69de7 to f33fe5c Compare June 4, 2025 20:26
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.

5 participants