OCPBUGS-82532: Skip adoption of missing or terminal generated-by installplans - #3883
Conversation
ensureSubscriptionInstallPlanState adopts the installplan named by the olm.generated-by annotation whenever a subscription has no installplan reference. That is only valid while the generating plan is still in progress. Once the plan has been GC'd or has reached a terminal phase, adoption wedges the namespace: - plan missing: the NotFound error aborts syncResolvingNamespace before resolution, so no installplan is ever created again for any subscription in the namespace. - plan complete: the adoption resets the subscription to UpgradePending with currentCSV=startingCSV, which no longer exists after upgrades. The change is never persisted and the sync bails out before resolution on every iteration. Both are hit by deleting an unapproved installplan (a documented way to get a plan for a newer version when one is pending), on any namespace with dependency-generated subscriptions, e.g. ODF. Treat a missing plan as "nothing to adopt" and skip adoption of plans in a terminal phase so resolution can create a fresh installplan. Failed plans are still adopted when fail-forward is enabled, which depends on the subscription referencing them. Fixes OCPBUGS-82532 Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Harald Klein <hklein@redhat.com>
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @haklein. Thanks for your PR. I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a resolution-wedging edge case in the Catalog Operator’s namespace resolution loop by preventing ensureSubscriptionInstallPlanState from “adopting” an olm.generated-by InstallPlan when that InstallPlan is missing (GC’d) or has already reached a terminal phase, allowing normal resolution to proceed and create a fresh InstallPlan.
Changes:
- Treat
NotFoundwhen fetching theolm.generated-byInstallPlan as “nothing to adopt” (no error), so namespace resolution can continue. - Skip adoption when the generating InstallPlan is in a terminal phase (
Complete, andFailedwhen fail-forward is disabled). - Add unit tests covering missing, transient-error, terminal-phase, and fail-forward adoption behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pkg/controller/operators/catalog/operator.go |
Avoids wedging namespace resolution by skipping adoption for missing or terminal olm.generated-by InstallPlans. |
pkg/controller/operators/catalog/operator_test.go |
Adds regression/unit tests for the new adoption-skipping behavior and error handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/ok-to-test |
|
/jira refresh |
ensureSubscriptionInstallPlanStateadopts the installplan named by theolm.generated-byannotation whenever a subscription has no installplan reference. That is only valid while the generating plan is still in progress. Once the plan has been GC'd or has reached a terminal phase, adoption wedges the namespace:NotFounderror abortssyncResolvingNamespacebefore resolution, so no installplan is ever created again for any subscription in the namespace.UpgradePendingwithcurrentCSV=startingCSV, which no longer exists after upgrades. The change is never persisted and the sync bails out before resolution on every iteration.Both are hit by deleting an unapproved installplan (a documented way to get a plan for a newer version when one is pending), on any namespace with dependency-generated subscriptions, e.g. ODF.
Description of the change:
Treat a missing plan as "nothing to adopt" and skip adoption of plans in a terminal phase so resolution can create a fresh installplan. Failed plans are still adopted when fail-forward is enabled, which depends on the subscription referencing them.
Motivation for the change:
Fixes OCPBUGS-82532
Architectural changes:
n/a
Testing remarks:
Unit tests cover the full decision table of the adoption path:
The two "not adopted"/"no error" rows are regression tests and fail against the previous code.
Reviewer Checklist
/doc[FLAKE]are truly flaky and have an issue