-
Notifications
You must be signed in to change notification settings - Fork 68
🐛 Fix Boxcutter manifest ordering inconsistency #2329
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
🐛 Fix Boxcutter manifest ordering inconsistency #2329
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5897825 to
8b067ab
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2329 +/- ##
==========================================
- Coverage 74.19% 70.52% -3.68%
==========================================
Files 91 91
Lines 7228 7239 +11
==========================================
- Hits 5363 5105 -258
- Misses 1433 1699 +266
- Partials 432 435 +3
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:
|
I think this is intentional. We need |
I think the original behavior makes sense. We shouldn't keep |
| // to ensure consistent ordering regardless of input order. This is critical for | ||
| // Helm-to-Boxcutter migration where the same resources may come from different sources | ||
| // (Helm release manifest vs bundle manifest) and need to produce identical phases. | ||
| func compareClusterExtensionRevision(a, b ocv1.ClusterExtensionRevisionObject) int { |
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.
| func compareClusterExtensionRevision(a, b ocv1.ClusterExtensionRevisionObject) int { | |
| func compareClusterExtensionRevisionObject(a, b ocv1.ClusterExtensionRevisionObject) int { |
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.
or even just compareRevisionObject ?
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 have a rename for this, but I'm waiting on it, in case the decision is that we don't want the CollisionProtection change.
So, removing either of the changes will cause the bug (two CERs created) to assert itself. If we are OK with this, then we don't necessarily need this fix, although sorting the objects during the phase is probably still a good idea. @dtfranz and I found the same solution to the problem:
If we're good with having two initial CERs upon transition from the helm applier to the boxcutter applier, then I can reduce this to be just the sorting changes, and remove the CollisionProtection change. I would then close the bug as intentional. |
8b067ab to
4618467
Compare
|
@joelanford @dtfranz giving me 👍 doesn't really tell me what you want! Do we want to fix the two CER issue or just fix the sorting? |
ec218e0 to
0a3158f
Compare
|
@joelanford @dtfranz now only the sorting remains. |
|
/lgtm |
|
/lgtm |
| // to ensure consistent ordering regardless of input order. This is critical for | ||
| // Helm-to-Boxcutter migration where the same resources may come from different sources | ||
| // (Helm release manifest vs bundle manifest) and need to produce identical phases. | ||
| func compareClusterExtensionRevisionObjects(a, b ocv1.ClusterExtensionRevisionObject) int { |
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.
would using cmp.Compare be a nice alternative here? e.g.
cmp.Compare(cmp.Or(aGVK.Group, bGVK.Group), cmp.Or(...), ...)
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.
return cmp.Compare(
cmp.Or(a.Object.GroupVersionKind().Group, b.Object.GroupVersionKind().Group),
cmp.Or(a.Object.GroupVersionKind().Version, b.Object.GroupVersionKind().Version),
cmp.Or(a.Object.GroupVersionKind().Kind, b.Object.GroupVersionKind().Kind),
cmp.Or(a.Object.GetNamespace(), b.Object.GetNamespace()),
cmp.Or(a.Object.GetName(), b.Object.GetName()),
)
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.
only a suggestion - if it doesn't spark joy, I'm happy to approve. Let me know.
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'm not familiar with that API, right now, it's not sparking joy (😉), but what's here works... so let's leave as-is.
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.
np - it's the cool kid in town: https://pkg.go.dev/cmp basically obviates a lot the branching here
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, perdasilva The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| } | ||
|
|
||
| // Compare Version | ||
| if aGVK.Version < bGVK.Version { |
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.
Add another couple of resources to the test that exercise the version comparison (or just change one of the current resources to use the apps/v2 api group or something) - I think that will clear the codecov problem
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.
If I do this, then I might as well look at cmp
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.
And it's still less than threshold... 😢
Issue: Manifest ordering inconsistency: CRDs from Helm release manifest and bundle manifest appeared in different orders, causing PhaseSort to produce different phase structures even though they contained the same objects. Solution: Added deterministic sorting in PhaseSort (phase.go): - Sort objects within each phase by Group, Version, Kind, Namespace, Name - Ensures consistent phase structure regardless of input order - Critical for comparing revisions from different sources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Todd Short <tshort@redhat.com>
0a3158f to
48e05e1
Compare
|
/lgtm |
|
/override project |
|
@tmshort: /override requires failed status contexts, check run or a prowjob name to operate on.
Only the following failed contexts/checkruns were expected:
If you are trying to override a checkrun that has a space in it, you must put a double quote on the context. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/override codecov/project |
|
@tmshort: Overrode contexts on behalf of tmshort: codecov/project In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
f3569d5
into
operator-framework:main
Issue:
Manifest ordering inconsistency: CRDs from Helm release manifest and
bundle manifest appeared in different orders, causing PhaseSort to
produce different phase structures even though they contained the same
objects.
Solution:
Added deterministic sorting in PhaseSort (phase.go):
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
Description
Reviewer Checklist