OCPBUGS-82532: Skip adoption of missing or terminal generated-by installplans - #3883
Conversation
|
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 |
|
/approve |
|
@haklein, the OCPBUGS issue mentions ODF. However ODF does some funky stuff where it creates more Subscriptions in Before we move forward with this, I would ask that we try to reproduce with:
|
|
/hold For the above request. |
|
/approve cancel |
|
[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 |
f3aec06 to
8ef96ef
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe subscription install-plan reconciliation now skips missing generated InstallPlans, adopts terminal plans only when ChangesInstallPlan adoption reconciliation
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: can't unmarshal config by viper (flags, file): 1 error(s) decoding:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ensureSubscriptionInstallPlanState adopts the installplan that the olm.generated-by annotation names when a subscription has no installplan reference. The code does not check the state of that installplan. On a cluster that upgraded after the subscription was created, adoption blocks installplan creation for the whole namespace in two ways: - The installplan is gone. Garbage collection keeps only the 5 newest installplans, so this is the normal state on a long-lived cluster. The NotFound error from the lookup aborts syncResolvingNamespace before resolution. As a result, the catalog-operator never creates an installplan again for any subscription in the namespace. - The installplan is complete, and the CSV that it recorded is gone. Adoption resets the subscription to UpgradePending with currentCSV=startingCSV. After an intermediate upgrade, that CSV no longer exists. The sync never persists this change and stops before resolution on every iteration. Deletion of an unapproved installplan triggers both paths on any namespace with dependency-generated subscriptions, for example ODF. Treat a missing installplan as "nothing to adopt". Skip adoption of a terminal installplan only when spec.startingCSV no longer names an existing CSV. This condition protects new dependency subscriptions: they sync after their generating installplan completes, and adoption of that installplan links them to their installed CSV. The catalog-operator still adopts failed installplans when fail-forward is enabled, because fail-forward depends on the subscription reference to the failed installplan. Fixes OCPBUGS-82532 Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Harald Klein <hklein@redhat.com>
8ef96ef to
4685990
Compare
|
@joelanford thanks a lot for your feedback. Please bear with the slow reply, I was on PTO last week.
I've deployed ODF 4.20 in a lab, and so far the approval mode was automatic out of the box. We do have an ODF doc section "Changing the update approval strategy" which shows how to change to manual. So that's likely done by customers on numerous ODF installations
This does reproduce outside of ODF, see below
This doesn't shop up with a simple operator, only if one depends on another and when OLM itself creates that subscription. Tested with a dummy operator, and replacing the versions v0.1.0 to v0.4.0 (via replaces chain). That didn’t reproduce, as it was missing the
Results from a test with two operators, one depending on the other. testop v0.5.0 declares an olm.package dependency on testdep v0.1.0. A second catalog tag adds testop v0.6.0 and testdep v0.2.0, so that one pending InstallPlan references both subscriptions.
Result: OLM does not create a new InstallPlan again. The subscriptions stay without a plan reference. The catalog-operator log shows this loop: As soon as the |
|
A new dependency subscription syncs after its generating installplan completes, and it needs adoption of that installplan to link to its installed CSV. The first version skipped all terminal InstallPlans, so these subscriptions failed with |
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 issueSummary by CodeRabbit
Bug Fixes
Tests