-
Notifications
You must be signed in to change notification settings - Fork 68
🐛 Fix deprecation conditions leaking install errors #2296
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?
🐛 Fix deprecation conditions leaking install errors #2296
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 deprecation status handling in ClusterExtension reconciliation to ensure deprecation conditions accurately reflect catalog data and installed bundle state, preventing install/validation errors from leaking into deprecation conditions.
- Moved deprecation status updates to a deferred function that runs at the end of reconciliation
- Changed BundleDeprecated condition to use
Unknownstatus withReasonAbsentwhen no bundle is installed - Updated test expectations to handle multiple possible error messages for sourceType validation
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/operator-controller/controllers/clusterextension_controller.go | Refactored deprecation status logic with deferred updates and new condition semantics for uninstalled bundles |
| internal/operator-controller/controllers/clusterextension_controller_test.go | Added tests for deprecation handling with resolution failures and applier failures; updated test expectations for BundleDeprecated conditions |
| test/e2e/cluster_extension_install_test.go | Updated e2e tests to verify deprecation conditions in success and failure scenarios |
| internal/operator-controller/controllers/clusterextension_admission_test.go | Enhanced sourceType validation test to handle multiple possible error message formats |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_admission_test.go
Outdated
Show resolved
Hide resolved
0891f37 to
4f61e6a
Compare
4f61e6a to
2b26273
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 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2296 +/- ##
==========================================
+ Coverage 74.23% 74.29% +0.05%
==========================================
Files 90 90
Lines 7014 7053 +39
==========================================
+ Hits 5207 5240 +33
- Misses 1398 1404 +6
Partials 409 409
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:
|
2b26273 to
ad9ccfd
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 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
internal/operator-controller/controllers/clusterextension_controller_test.go:1
- The assertion
require.Contains(ct, []string{...}, cond.Reason)is semantically backwards. TheContainsfunction expects a slice as the second argument and the search item as the first. This should berequire.Contains(ct, cond.Reason, []string{ocv1.ReasonFailed, ocv1.ReasonAbsent})or userequire.True(ct, slices.Contains([]string{ocv1.ReasonFailed, ocv1.ReasonAbsent}, cond.Reason)).
package controllers_test
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
ad9ccfd to
a6d0678
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 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a6d0678 to
287bede
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.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
287bede to
b2da76f
Compare
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
|
Hi @pedjak
Thanks for calling that out! I agree the block could be clearer overall, but this PR doesn’t change the behavior the comment describes—we still only surface deprecation conditions when the catalog tells us something is deprecated. The new logic just makes sure the controller actually honors what’s written there (and adds the Unknown case until a bundle lands). I’d rather keep doc polish out of this PR so we can tackle a broader wording update separately. WDYT in a fallow up make / enhance doc api explaination for .. with this purpose? |
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 no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e140939 to
90a53c0
Compare
Maybe it is just how I read it, here is the actual snippet:
What blocks us from doing it this PR? |
|
Hi @pedjak
I’d rather keep this PR focused on the bug fix (stopping the install error leaks and handling Unknown/Absent correctly). However, following your suggestion, I updated the descriotion to be more compreenshive. |
5838d32 to
748e63f
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 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
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.
/lgtm does PR title need to contain both :bug: (fix): or :bug: is enough?
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pedjak 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 |
748e63f to
442ef2b
Compare
|
New changes are detected. LGTM label has been removed. |
442ef2b to
5b36d85
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 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
internal/operator-controller/controllers/clusterextension_controller.go
Outdated
Show resolved
Hide resolved
5b36d85 to
4e1486d
Compare
4e1486d to
52a2b72
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 12 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- stop copying install/validation errors into deprecation conditions - base bundle deprecation on the installed bundle (Unknown when none) - extend unit tests to cover resolver failures with catalog deprecations - update docs to provide a more compreehnesinve info Assisted-by: Cursor
52a2b72 to
c15272d
Compare
| defer func(resolvedDeprecationPtr **declcfg.Deprecation, revisionStatesPtr **RevisionStates) { | ||
| installedBundleName := "" | ||
| if revisionStatesPtr != nil && *revisionStatesPtr != nil && (*revisionStatesPtr).Installed != nil { | ||
| installedBundleName = (*revisionStatesPtr).Installed.Name | ||
| } | ||
| var resolvedDeprecationVal *declcfg.Deprecation | ||
| if resolvedDeprecationPtr != nil { | ||
| resolvedDeprecationVal = *resolvedDeprecationPtr | ||
| } | ||
| SetDeprecationStatus(ext, installedBundleName, resolvedDeprecationVal) | ||
| }(&resolvedDeprecation, &revisionStates) |
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.
Could we actually simplify the deferring function, i.e. avoid passing args, and declare it as a closure?
defer func() {
installedBundleName := ""
if revisionStates != nil && revisionStates.Installed != nil {
installedBundleName = revisionStates.Installed.Name
}
SetDeprecationStatus(ext, installedBundleName, resolvedDeprecation)
}()| channelSet = sets.New(ext.Spec.Source.Catalog.Channels...) | ||
| } else { | ||
| channelSet = sets.New[string]() |
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.
to avoid else statement, we could simplify to:
channelSet := sets.New[string]()
if ext.Spec.Source.Catalog != nil {
channelSet.Insert(ext.Spec.Source.Catalog.Channels...)
}
Description
TL'DR:
Before:
Any install or validation failure copied the error message into every deprecation condition
(Deprecated, PackageDeprecated, ChannelDeprecated, BundleDeprecated). Bundle deprecation was taken from the “resolved” bundle, even if nothing actually installed, so a failed install still wroteFalse/Failedwith the installer error.After:
Deprecation conditions are updated only after reconcile finishes and only from catalog data.
Unknown/Absentwhen nothing is on cluster,True/Deprecatedonly when the installed bundle is truly deprecated.Tests cover both Helm and Boxcutter paths plus resolver failures with catalog deprecations. This stops the install error from leaking into deprecation status and matches the expected behavior described in Issue #2008.
Motivation
Closes: #2008