-
Notifications
You must be signed in to change notification settings - Fork 65
✨ 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 73.81% 73.80% -0.02%
==========================================
Files 80 81 +1
Lines 7154 7330 +176
==========================================
+ Hits 5281 5410 +129
- Misses 1550 1584 +34
- Partials 323 336 +13
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
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
4b69de7
to
f33fe5c
Compare
Also added logic to inspect the contents of a operator-controller/internal/shared/util/image/helm.go Lines 97 to 135 in 059008d
|
959072a
to
b569fb8
Compare
b569fb8
to
9f59039
Compare
9f59039
to
c08ce64
Compare
ociImg, err := img.OCIConfig(ctx) | ||
if err != nil { | ||
return nil, time.Time{}, err | ||
} | ||
|
||
layerIter := iter.Seq[LayerData](func(yield func(LayerData) bool) { | ||
for i, layerInfo := range img.LayerInfos() { | ||
ld := LayerData{Index: i} | ||
ld := LayerData{Index: i, MediaType: layerInfo.MediaType} |
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.
It is added with the helm chart, but I think it is OK to exist on the default code as well.
@tmshort @thetechnick WDYT?
c08ce64
to
9b366d3
Compare
internal/shared/util/image/cache.go
Outdated
switch layer.MediaType { | ||
case registry.ChartLayerMediaType: | ||
if err := storeChartLayer(dest, layer); err != nil { | ||
return err | ||
} | ||
default: | ||
if _, err := archive.Apply(ctx, dest, layer.Reader, applyOpts...); err != nil { | ||
return fmt.Errorf("error applying layer[%d]: %w", layer.Index, err) | ||
} |
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.
Should it not be protected behind the feature flag as well?
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.
The code will be unreachable as a result of the pullChart()
function being wrapped around a feature gate. However, if we need to wrap that code as well, feel tree to let me know
operator-controller/internal/shared/util/image/pull.go
Lines 228 to 232 in 9b366d3
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) { | |
if hasChart(img) { | |
return pullChart(ctx, ownerID, srcRef, canonicalRef, imgSrc, cache) | |
} | |
} |
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.
I believe that all code should be categorised under a flag, allowing us to easily identify the purpose of each specific code for each alpha/beta feature. However, I think we can wait for others' input to see what they think about. My concern is:
What happens if we decide not to use the alpha/beta feature and want to delete it? If we decide not to promote feature A or B. How hard will it be if not all related code is not under the feature flag condition? But others might think that is OK
@perdasilva @tmshort WDYT?
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.
Similarly to my comment above about moving the feature flag checks to main, should we refactor this in a way that make the cache configurable as to the different layer media types and how they are handled?
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.
actually - the comment is below =P
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.
Learning moment for me here. How have we removed feature gated code that we have decided not to land in the past? Is using the git history to undo code that is associated with a feature gate sufficient or acceptable?
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.
I think it’d be helpful to keep all changes behind the feature gate clearly wrapped and centralized. That way, it’s easy to track what’s gated just by reading the code—since we’ll likely be iterating over multiple PRs, relying on Git history isn’t ideal.
Totally open to any approach that makes the boundary clear. The primary goal is to maintain cohesion and ensure we all share a common understanding of what lies behind the gate. 😊
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.
Understood. With that being said, from my perspective our options might be:
- Execute tests with feature gates enabled
- Extend the cache to allow tests to run even when the feature gate is disabled
- Don't wrap the Helm logic in the cache
Store()
method which will allow tests to run even with feature gate disabled
Open to hear any other ideas or if we might have a preference for one of these options over others.
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.
@camilamacedo86 I was able to get a way to wrap the code and allow tests to run without issue. Hopefully that could suffice for now as we deliberate if to land the feature or not.
operator-controller/internal/shared/util/image/cache.go
Lines 137 to 141 in fb98756
if features.OperatorControllerFeatureGate.Enabled(features.HelmChartSupport) || testing.Testing() { | |
if err := storeChartLayer(dest, layer); err != nil { | |
return err | |
} | |
} |
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle/source" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/preflights/crdupgradesafety" | ||
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util" | ||
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image" |
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.
Here: https://github.com/operator-framework/operator-controller/pull/1724/files
@perdasilva added a demo and the doc under the docs/draft for another alpha feature
It would be very nice if we could do your demo within and add the doc for that. Such as it was done in this PR. However, I am okay with it being a follow-up.
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.
I would be for adding documentation and a demo as a follow up.
735a6d9
to
036e4c8
Compare
036e4c8
to
0dfea34
Compare
@@ -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) { |
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.
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?
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.
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?
* 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]>
0dfea34
to
fb98756
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