-
Notifications
You must be signed in to change notification settings - Fork 64
✨ 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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3b36dfb
to
272dcbf
Compare
internal/shared/util/image/pull.go
Outdated
if hasChart(img) { | ||
return pullChart(ctx, ownerID, imgSrc, canonicalRef, cache, layoutDir) | ||
} | ||
|
||
// Helm charts would error when getting OCI config |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
operator-controller/internal/shared/util/image/helm.go
Lines 35 to 73 in 059008d
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) | |
} |
272dcbf
to
39948a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH. Great work 🥇
6dfc6c0
to
059008d
Compare
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. operator-controller/internal/shared/util/image/helm.go Lines 62 to 65 in 059008d
|
059008d
to
797bddb
Compare
73f63ab
to
4b69de7
Compare
* 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]>
4b69de7
to
f33fe5c
Compare
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