fix lvms-operator catalog resolution in ocp4.22+#10459
Conversation
WalkthroughAdds three exported constants to ChangesLVM Fallback CatalogSource Manifest Injection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 13 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (13 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Hi @eliajahshan. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: eliajahshan 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/operators/lvm/manifest.go (1)
33-43: ⚡ Quick winAdd explicit unit coverage for the new fallback-catalog branch.
Please add tests that assert: (1) Line 33+ behavior includes
50_openshift-lvm_catalog_source.yamlfor OCP4.22.0+, (2) it is absent below4.22.0, and (3) Line 144 usesredhat-operators-v4-21only in the fallback case. This is the new risk surface and currently isn’t directly asserted in the provided LVM tests.Also applies to: 57-65, 72-80, 84-90, 144-163
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/operators/lvm/manifest.go` around lines 33 - 43, Add explicit unit test coverage for the new fallback-catalog branch logic in the LVM manifest generation. Create test cases that assert: (1) when the cluster OpenShift version is 4.22.0 or greater, the needsFallbackCatalog check triggers and the getCatalogSource function is called to populate openshiftManifests with the 50_openshift-lvm_catalog_source.yaml key, (2) when the cluster version is below the LvmsCatalogFallbackMinVersion threshold, the fallback catalog source is not included in the manifests, and (3) the redhat-operators-v4-21 catalog source is only used in the fallback case path. These tests will cover the new risk surface created by this feature branch and ensure the conditional logic behaves correctly across version boundaries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/operators/lvm/manifest.go`:
- Around line 33-43: Add explicit unit test coverage for the new
fallback-catalog branch logic in the LVM manifest generation. Create test cases
that assert: (1) when the cluster OpenShift version is 4.22.0 or greater, the
needsFallbackCatalog check triggers and the getCatalogSource function is called
to populate openshiftManifests with the 50_openshift-lvm_catalog_source.yaml
key, (2) when the cluster version is below the LvmsCatalogFallbackMinVersion
threshold, the fallback catalog source is not included in the manifests, and (3)
the redhat-operators-v4-21 catalog source is only used in the fallback case
path. These tests will cover the new risk surface created by this feature branch
and ensure the conditional logic behaves correctly across version boundaries.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 7aaf8be1-e1ff-4768-b488-e4751a17c5a1
📒 Files selected for processing (2)
internal/operators/lvm/config.gointernal/operators/lvm/manifest.go
Description:
Problem
When deploying a cluster with the LVM operator enabled on OCP 4.22+, the installation gets stuck at the "Waiting for olm operators csv initialization" stage and eventually times out. The root cause is that
lvms-operatoris no longer published in theredhat-operator-index:v4.22catalog in the gRPC format required by the legacy OLM v1alpha1SubscriptionAPI.The OLM Subscription enters
ResolutionFailedstate with:Because OLM can never resolve the Subscription to an InstallPlan, no CSV is ever created in
openshift-storage, and the install times out.Fix
For OCP ≥ 4.22, assisted-service now injects an additional
CatalogSourcemanifest pointing toredhat-operator-index:v4.21(wherelvms-operatoris still available). The LVMS Subscription is then directed at this fallback catalog source instead of the defaultredhat-operators.For OCP < 4.22 the behavior is completely unchanged — the Subscription continues to use
redhat-operatorsas before.Files Changed
internal/operators/lvm/config.go— added 3 constants:LvmsCatalogFallbackMinVersion(4.22.0),LvmsCatalogFallbackName,LvmsCatalogFallbackImageinternal/operators/lvm/manifest.go:Manifests()— injects50_openshift-lvm_catalog_source.yamlfor OCP ≥ 4.22getSubscriptionInfo()— sets catalog source dynamically based on OCP versionLvmSubscriptiontemplate —sourcefield is now dynamic instead of hardcodedredhat-operatorsLvmCatalogSourcetemplate andgetCatalogSource()functionPrecedent
This is the same workaround pattern already used for LSO (
deploy/operator/setup_lso.sh), which went through the identical issue on 4.22 and then again on 5.0. The TODO comment is intentional — the workaround should be removed oncelvms-operatoris published to the 4.22 catalog.Testing
lvms-operatorCSV is created and operator reachesSucceeded50_openshift-lvm_catalog_source.yamlmanifest is generated for OCP 4.22+Summary by CodeRabbit