Skip to content

✨ Implement Boxcutter #1946

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

thetechnick
Copy link
Contributor

Description

Reviewer Checklist

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2025
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 30, 2025
Copy link

netlify bot commented Apr 30, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 9401d71
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/68791d2f254a5000081562b9
😎 Deploy Preview https://deploy-preview-1946--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.

Comment on lines +64 to +69
type ClusterExtensionRevisionObject struct {
// +kubebuilder:validation:EmbeddedResource
// +kubebuilder:pruning:PreserveUnknownFields
Object unstructured.Unstructured `json:"object"`
}
Copy link
Member

Choose a reason for hiding this comment

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

I suspect embedding fully objects in the ClusterExtensionRevision will immediately fall over for the larger registry+v1 bundles, particularly those that ship many CRDs, which tend to be large due to descriptions and schemas.

Thoughts on sharding objects out to secrets or some other resource?

Comment on lines 67 to 75
labels := obj.GetLabels()
if labels == nil {
labels = map[string]string{}
}
for k, v := range objectLabels {
labels[k] = v
}
Copy link
Member

@joelanford joelanford Apr 30, 2025

Choose a reason for hiding this comment

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

nit: This could be simplified using the new-ish maps package in the standard library.

Suggested change
labels := obj.GetLabels()
if labels == nil {
labels = map[string]string{}
}
for k, v := range objectLabels {
labels[k] = v
}
labels := maps.Clone(obj.GetLabels())
maps.Copy(labels, objectLabels)

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL

Comment on lines +195 to +236
hasher.Reset()

printer := spew.ConfigState{
Indent: " ",
SortKeys: true,
DisableMethods: true,
SpewKeys: true,
}
if _, err := printer.Fprintf(hasher, "%#v", objectToWrite); err != nil {
panic(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this an OLM-ism or a boxcutter-ism? I wonder if json.NewEncoder(hasher).Encode(objectToWrite) would be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 208 to 221
type revisionAscending []ocv1.ClusterExtensionRevision

func (a revisionAscending) Len() int { return len(a) }
func (a revisionAscending) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a revisionAscending) Less(i, j int) bool {
iObj := a[i]
jObj := a[j]

return iObj.Spec.Revision < jObj.Spec.Revision
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: might be able to avoid the type definition and associated boilerplate with slices.SortFunc?

Copy link

openshift-ci bot commented May 7, 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 grokspawn 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

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2025
@perdasilva perdasilva force-pushed the poc-boxcutter branch 2 times, most recently from 1c23866 to dc66501 Compare July 15, 2025 11:12
@perdasilva perdasilva changed the title POC: Implement Boxcutter ✨ Implement Boxcutter Jul 15, 2025
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 4.73373% with 644 lines in your changes missing coverage. Please review.

Project coverage is 67.64%. Comparing base (5f5142d) to head (9401d71).

Files with missing lines Patch % Lines
...controllers/clusterextensionrevision_controller.go 0.00% 290 Missing ⚠️
internal/operator-controller/applier/boxcutter.go 0.00% 139 Missing ⚠️
api/v1/zz_generated.deepcopy.go 0.00% 114 Missing ⚠️
cmd/operator-controller/main.go 34.17% 44 Missing and 8 partials ⚠️
...perator-controller/rukpak/util/testing/bundlefs.go 0.00% 42 Missing ⚠️
...troller/controllers/clusterextension_controller.go 30.00% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1946      +/-   ##
==========================================
- Coverage   73.55%   67.64%   -5.91%     
==========================================
  Files          78       82       +4     
  Lines        7260     7912     +652     
==========================================
+ Hits         5340     5352      +12     
- Misses       1568     2201     +633     
- Partials      352      359       +7     
Flag Coverage Δ
e2e 40.22% <4.73%> (-3.50%) ⬇️
experimental-e2e 45.81% <4.88%> (-4.18%) ⬇️
unit 54.06% <0.29%> (-4.81%) ⬇️

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.

thetechnick and others added 10 commits July 17, 2025 17:15
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
@perdasilva perdasilva force-pushed the poc-boxcutter branch 3 times, most recently from f796c03 to 9e976a7 Compare July 17, 2025 15:38
Signed-off-by: Per Goncalves da Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants