-
Notifications
You must be signed in to change notification settings - Fork 68
WIP ✨ (Valid for Boxcutter Runtime Only) switched to label-based revision lookups — faster, safer, and no orphans left behind. #2315
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. |
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.
Pull Request Overview
This PR refactors how previous revisions are discovered during ClusterExtensionRevision reconciliation. Instead of relying on a static Spec.Previous field, the controller now dynamically queries for previous revisions using the owner label, enabling more flexible revision management.
Key changes:
- Introduced
ListPreviousRevisions()method to dynamically discover sibling revisions - Updated
toBoxcutterRevision()to callListPreviousRevisions()and return errors - Enhanced test coverage with comprehensive test cases for the new listing logic
- Improved test names and added scenario comments for better readability
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/operator-controller/controllers/clusterextensionrevision_controller.go | Added ListPreviousRevisions() method for dynamic revision discovery, refactored toBoxcutterRevision() signature to return errors, removed unused unstructured import |
| internal/operator-controller/controllers/clusterextensionrevision_controller_test.go | Added comprehensive tests for ListPreviousRevisions(), updated test names to be more descriptive, added scenario comments, updated mockTrackingCache to delegate Get/List to actual client, removed obsolete Spec.Previous test setup, added owner label to test revision helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2315 +/- ##
==========================================
+ Coverage 71.14% 74.12% +2.97%
==========================================
Files 91 91
Lines 7046 7095 +49
==========================================
+ Hits 5013 5259 +246
+ Misses 1618 1416 -202
- Partials 415 420 +5
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:
|
3a1c266 to
9c8f9af
Compare
|
[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 |
9c8f9af to
6026ae8
Compare
c067348 to
6076304
Compare
6076304 to
5a89bed
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.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| client. | ||
| On("Update", mock.Anything, mock.AnythingOfType("*v1.ClusterExtensionRevision"), mock.Anything). | ||
| Once(). | ||
| Return(nil) |
Copilot
AI
Nov 9, 2025
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 mock expects an Update call but the implementation uses Status().Update() which calls the status writer's Update method. The mock should expect the status update through the status writer, not a direct Update on the client.
| ObservedGeneration: rev.Generation, | ||
| }) | ||
| meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{ | ||
| Type: ocv1.ClusterExtensionRevisionTypeSucceeded, | ||
| Status: metav1.ConditionTrue, | ||
| Reason: ocv1.ClusterExtensionRevisionReasonRolloutSuccess, | ||
| Message: "Migrated from Helm storage", | ||
| ObservedGeneration: rev.Generation, |
Copilot
AI
Nov 9, 2025
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.
Using rev.Generation here will be 0 since the revision hasn't been persisted yet. The generation is only set by the API server after creation. This should likely be set to 1 or the ObservedGeneration field should be set after the revision is created and its generation is known.
| ObservedGeneration: rev.Generation, | |
| }) | |
| meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{ | |
| Type: ocv1.ClusterExtensionRevisionTypeSucceeded, | |
| Status: metav1.ConditionTrue, | |
| Reason: ocv1.ClusterExtensionRevisionReasonRolloutSuccess, | |
| Message: "Migrated from Helm storage", | |
| ObservedGeneration: rev.Generation, | |
| ObservedGeneration: 1, | |
| }) | |
| meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{ | |
| Type: ocv1.ClusterExtensionRevisionTypeSucceeded, | |
| Status: metav1.ConditionTrue, | |
| Reason: ocv1.ClusterExtensionRevisionReasonRolloutSuccess, | |
| Message: "Migrated from Helm storage", | |
| ObservedGeneration: 1, |
5a89bed to
fbf27d6
Compare
…it chains Instead of tracking revision history through Spec.Previous fields, we now find related revisions using labels and the controller-runtime cache. This is more efficient and works better with controller-runtime's caching layer. To support this change, the Helm-to-Boxcutter migration now sets ownerReferences on migrated revisions, ensuring they work identically to newly created revisions. Assisted-by: Cursor
fbf27d6 to
c7ea251
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.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Scenario: Given a ClusterExtensionRevision, find all related active previous revisions | ||
| // - When the revision has no owner label, return empty list (revision not properly labeled) | ||
| // - When looking up by owner label, filter out the current revision itself | ||
| // - When a revision is archived or being deleting, exclude it from results |
Copilot
AI
Nov 9, 2025
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.
Typo in comment: "being deleting" should be "being deleted"
| // - When a revision is archived or being deleting, exclude it from results | |
| // - When a revision is archived or being deleted, exclude it from results |
Revisions are now discovered using a label-based cache instead of walking explicit
Spec.Previouschains.This makes lookups faster, safer, and ensures no orphan revisions are left behind when a ClusterExtension is deleted.
Migration automatically sets
ownerReferencesfor existing revisions.What Changed
Before:
Spec.PreviousownerReferencesNow:
olm.operatorframework.io/ownerownerReferencesWhy It's Better
Where it matters ( With Boxcutter runtime only )
ownerReferences