Skip to content

Conversation

joelanford
Copy link
Collaborator

Description

Reviewer Checklist

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (poc-boxcutter@01cf0d3). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@               Coverage Diff                @@
##             poc-boxcutter      #11   +/-   ##
================================================
  Coverage                 ?   71.96%           
================================================
  Files                    ?       85           
  Lines                    ?     8128           
  Branches                 ?        0           
================================================
  Hits                     ?     5849           
  Misses                   ?     1890           
  Partials                 ?      389           
Flag Coverage Δ
e2e 40.05% <78.57%> (?)
experimental-e2e 44.60% <85.71%> (?)
unit 56.49% <78.57%> (?)

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.

// which follows pointers and prints actual values of the nested objects
// ensuring the hash does not change when a pointer changes.
func DeepHashObject(obj interface{}) (string, error) {
func DeepHashObject(obj interface{}) string {
Copy link

Choose a reason for hiding this comment

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

I would keep keep the previous signature, returning error is safer/less surprising to the caller than raising panic. If the panic is not caught, it kills the process, which might be problematic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My thought process here is if we (the programmers) manage to send in an un-marshalable object, it seems like the error would be essentially unrecoverable for a user.

We have metrics collected/alerted in our e2e if anything in our e2e causes panics, so as long as we have decent e2e test coverage, we should catch any panic possibility in pre-merge testing.

@thetechnick's original hash function also panic-ed on an unexpected error, so I followed that lead. I don't have strong opinions on this though.

Comment on lines 10 to 12
// DeepHashObject writes specified object to hash using the spew library
// which follows pointers and prints actual values of the nested objects
// ensuring the hash does not change when a pointer changes.
Copy link

Choose a reason for hiding this comment

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

It looks like the docs should be update as well, given that we do not use spew library anymore?

encoder := json.NewEncoder(hasher)
if err := encoder.Encode(obj); err != nil {
return "", fmt.Errorf("couldn't encode object: %w", err)
panic(fmt.Sprintf("couldn't encode object: %v", err))
Copy link

Choose a reason for hiding this comment

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

see the comment above.

}

// base62(sha224(bytes)) is a useful hash and encoding for adding the contents of this
// base36(sha224(bytes)) is a useful hash and encoding for adding the contents of this
Copy link

Choose a reason for hiding this comment

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

why not going with base62 instead, i.e. returning i.Text(62)? It is more compact, hashes are shorter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Somehow, something seems like it was lost in translation when we ported this from OLM to rukpak to here.

In OLMv0 it looks like this: https://github.com/operator-framework/operator-lifecycle-manager/blob/b9e6cce9f3f08aaffa305f3b3add0e71a34cee20/pkg/lib/kubernetes/pkg/util/hash/hash.go#L47-L54

In rukpak it looks like this: https://github.com/operator-framework/rukpak/blob/5ffcfff615566f3a1a482a5f6649cd3e07f2427f/pkg/util/hash.go#L31-L38

I'm up for changing this back to base62, but I think that may change the names of a decent chunk of objects that the registry+v1 converter produces.

My vote, leave as is for now. But I'll open a separate issue to focus on this question.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It also may be moot based on your dry-run suggestion last week.

Comment on lines 32 to 36
var (
i big.Int
hash = make([]byte, 0, hasher.Size())
)
i.SetBytes(hasher.Sum(hash))
Copy link

Choose a reason for hiding this comment

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

what is the benefit of this change vs previous code, or could we do this like instead?

var i big.Int
i.SetBytes(hasher.Sum(nil))
return i.Text(62)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call. I was thinking "pre-allocate the slice capacity", but the Sum method directly writes all the bytes in one go, so no need to pre-allocate.

Changing to your suggestion.

@thetechnick thetechnick force-pushed the poc-boxcutter branch 3 times, most recently from a0adcc0 to c175077 Compare September 5, 2025 14:43
dependabot bot and others added 8 commits September 5, 2025 17:05
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.23.1 to 1.23.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.23.2/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.23.1...v1.23.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.23.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update boxcutter library to branch with latest k8s and controller-runtime libs

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Update go.mod

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Add ClusterExtensionRevisionAPI

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Add BoxcutterRuntime featuregate

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Add Boxcutter applier

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Add ClusterExtensionRevision controller

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Add Boxcutter runtime to main

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Remove ClusterExtensionRevision from crd-docs

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Update hack/tools/update-crds.sh for ClusterExtensionRevision API

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Generate manifests

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Remove access manager and dynamic cache

Signed-off-by: Per Goncalves da Silva <[email protected]>

* Update boxcutter to v0.3.0, add TrackingCache to Runnables

* boxcutter webhook support

Signed-off-by: Joe Lanford <[email protected]>

* add BoxcutterRuntime feature gate to experimental release

Signed-off-by: Joe Lanford <[email protected]>

* add boxcutter cluster-admin cluster role binding in boxcutter's feature component

Signed-off-by: Joe Lanford <[email protected]>

* Boxcutter Preflight

Signed-off-by: Todd Short <[email protected]>

* Boxcutter Preflight mock cleanup

Signed-off-by: Todd Short <[email protected]>

* Use new TrackingCache Watch/Free.

Ensure informers are started before reconciling and stopped before
removing the finalizer.

* add BoxcutterInstalledBundleGetter, plumb bundle metadata into revision annotations

Signed-off-by: Joe Lanford <[email protected]>

* InstalledBundleGetter -> RevisionStatesGetter

This change accommodates the possibility of a revision that is currently
rolling out, which is possible for appliers that perform rollouts
asynchronously.

Signed-off-by: Joe Lanford <[email protected]>

* refactor Applier interface and improve status reporting

Signed-off-by: Joe Lanford <[email protected]>

* fixup tests for applier and installedbundlegetter changes

Signed-off-by: Joe Lanford <[email protected]>

* resolve linter issues

Signed-off-by: Joe Lanford <[email protected]>

* set status for other failure modes during ClusterExtensionRevision reconciliation

Signed-off-by: Joe Lanford <[email protected]>

* TODO: fail upgrade-e2e if revision storage is unmigrated

Signed-off-by: Joe Lanford <[email protected]>

* fixing broken tests after rebase

Signed-off-by: Joe Lanford <[email protected]>

* Boxcutter Phases

Defines a set of phases which facilitate a smoother installation vs applying every resource in the bundle all at once.

Signed-off-by: Daniel Franz <[email protected]>

* Const Cleanup

Captures conditions and reasons used by ClusterExtensionRevision into consts.

Signed-off-by: Daniel Franz <[email protected]>

* Add migration from helm to boxcutter revision

---------

Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Joe Lanford <[email protected]>
Signed-off-by: Todd Short <[email protected]>
Signed-off-by: Daniel Franz <[email protected]>
Co-authored-by: Per Goncalves da Silva <[email protected]>
Co-authored-by: Joe Lanford <[email protected]>
Co-authored-by: Todd Short <[email protected]>
Co-authored-by: Daniel Franz <[email protected]>
…or-framework#2196)

Bumps [pkg.package-operator.run/boxcutter](https://github.com/package-operator/boxcutter) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/package-operator/boxcutter/releases)
- [Commits](package-operator/boxcutter@v0.5.1...v0.6.0)

---
updated-dependencies:
- dependency-name: pkg.package-operator.run/boxcutter
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.27.0 to 0.28.0.
- [Commits](golang/mod@v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-version: 0.28.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.6.18 to 9.6.19.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.6.18...9.6.19)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-version: 9.6.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.16.0 to 0.17.0.
- [Commits](golang/sync@v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-version: 0.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Co-authored-by: Per Goncalves da Silva <[email protected]>
@joelanford
Copy link
Collaborator Author

Re-opened here: operator-framework#2201

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