Skip to content

OADP-7868: Skip CLI/VMDP download setup when Console CRD is absent#2170

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:oadp-devfrom
Joeavaikath:OADP-7868-fix-crashloop-no-console
Apr 22, 2026
Merged

OADP-7868: Skip CLI/VMDP download setup when Console CRD is absent#2170
openshift-merge-bot[bot] merged 2 commits intoopenshift:oadp-devfrom
Joeavaikath:OADP-7868-fix-crashloop-no-console

Conversation

@Joeavaikath
Copy link
Copy Markdown
Contributor

@Joeavaikath Joeavaikath commented Apr 21, 2026

Why the changes were made

Fixes: OADP-7868

The OADP controller-manager enters CrashLoopBackOff on OpenShift 4.22 clusters that do not have the Console capability enabled (e.g. SNO clusters).

During startup, the CLIDownloadSetup and VMDPDownloadSetup runnables unconditionally interact with the ConsoleCLIDownload CRD (console.openshift.io/v1). On clusters without Console capability, this CRD does not exist, causing the REST mapper to fail with a discovery error. The code only handles errors.IsNotFound (object-level absence) and does not account for CRD-level absence (meta.NoKindMatchError), resulting in a fatal error that terminates the manager.

The fix probes the REST mapper for the ConsoleCLIDownload GVK at the top of each runnable's Start() method. When the CRD is absent (meta.IsNoMatchError), setup is skipped gracefully — no deployment, service, route, or ConsoleCLIDownload resources are created. This is the correct behavior since these resources exist solely to surface CLI downloads through the Console UI, which is not present on these clusters.

How to test the changes made

  1. Run unit tests:

    go test ./internal/controller/ -run "TestIsConsoleCRD|TestCLIDownload|TestVMDPDownload" -v

    All 4 tests should pass, covering:

    • isConsoleCRDAvailable returns false when CRD is absent
    • isConsoleCRDAvailable returns true when CRD is present
    • CLIDownloadSetup.Start() returns nil and creates no resources when CRD is absent
    • VMDPDownloadSetup.Start() returns nil and creates no resources when CRD is absent
  2. Deploy on a cluster with Console capability and verify CLI/VMDP download resources are still created normally (no regression).

  3. Deploy on a cluster without Console capability (e.g. SNO with Console disabled) and verify the operator starts successfully without CrashLoopBackOff. Logs should show:

    ConsoleCLIDownload CRD not available (Console capability not enabled), skipping setup
    

Summary by CodeRabbit

Release Notes

  • New Features

    • Added detection for ConsoleCLIDownload custom resource availability.
    • CLI and VMDP download features are now conditionally enabled based on CRD presence.
  • Tests

    • Added comprehensive test coverage for CRD availability detection.

On OCP 4.22 clusters without Console capability (e.g. SNO), the
ConsoleCLIDownload CRD does not exist. The CLIDownloadSetup and
VMDPDownloadSetup runnables crash with a REST mapper error because
the code only handles errors.IsNotFound, not CRD-level absence.

Check CRD availability via RESTMapper before proceeding. When the
CRD is missing, skip all resource creation gracefully.

Signed-off-by: Joseph <jvaikath@redhat.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 21, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 21, 2026

@Joeavaikath: This pull request references OADP-7868 which is a valid jira issue.

Details

In response to this:

Why the changes were made

Fixes: OADP-7868

The OADP controller-manager enters CrashLoopBackOff on OpenShift 4.22 clusters that do not have the Console capability enabled (e.g. SNO clusters).

During startup, the CLIDownloadSetup and VMDPDownloadSetup runnables unconditionally interact with the ConsoleCLIDownload CRD (console.openshift.io/v1). On clusters without Console capability, this CRD does not exist, causing the REST mapper to fail with a discovery error. The code only handles errors.IsNotFound (object-level absence) and does not account for CRD-level absence (meta.NoKindMatchError), resulting in a fatal error that terminates the manager.

The fix probes the REST mapper for the ConsoleCLIDownload GVK at the top of each runnable's Start() method. When the CRD is absent (meta.IsNoMatchError), setup is skipped gracefully — no deployment, service, route, or ConsoleCLIDownload resources are created. This is the correct behavior since these resources exist solely to surface CLI downloads through the Console UI, which is not present on these clusters.

How to test the changes made

  1. Run unit tests:
go test ./internal/controller/ -run "TestIsConsoleCRD|TestCLIDownload|TestVMDPDownload" -v

All 4 tests should pass, covering:

  • isConsoleCRDAvailable returns false when CRD is absent
  • isConsoleCRDAvailable returns true when CRD is present
  • CLIDownloadSetup.Start() returns nil and creates no resources when CRD is absent
  • VMDPDownloadSetup.Start() returns nil and creates no resources when CRD is absent
  1. Deploy on a cluster with Console capability and verify CLI/VMDP download resources are still created normally (no regression).

  2. Deploy on a cluster without Console capability (e.g. SNO with Console disabled) and verify the operator starts successfully without CrashLoopBackOff. Logs should show:

ConsoleCLIDownload CRD not available (Console capability not enabled), skipping setup

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8dd5ed03-01f1-4b71-8c9b-4b3f1d9245fe

📥 Commits

Reviewing files that changed from the base of the PR and between 024537e and 9aa2d02.

📒 Files selected for processing (3)
  • cmd/main.go
  • internal/controller/console.go
  • internal/controller/console_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/controller/console_test.go

Walkthrough

This PR adds a new public function IsConsoleCRDAvailable() that checks whether the Kubernetes API server has the ConsoleCLIDownload CRD available via REST mapping. The function is integrated into the main entry point to conditionally register CLI/VMDP download setup runnables only when the CRD is present, alongside existing namespace scoping logic.

Changes

Cohort / File(s) Summary
CRD Availability Check
internal/controller/console.go
New public function IsConsoleCRDAvailable() that queries the REST mapper for ConsoleCLIDownload CRD availability in the consolev1 group, handling no-match errors gracefully and wrapping other errors.
CRD Availability Tests
internal/controller/console_test.go
Table-driven unit tests for IsConsoleCRDAvailable() covering scenarios with and without CRD registration in the REST mapper.
Conditional Runner Registration
cmd/main.go
Updated setup runner registration logic to call IsConsoleCRDAvailable() and only register CLIDownloadSetup and VMDPDownloadSetup when the CRD is available, in addition to existing namespace scoping checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning Test lacks meaningful failure messages on assertions, violating codebase patterns found in backup_repository_test.go and monitor_test.go. Add descriptive assertion messages to lines 46-47 explaining what each assertion validates for better test failure diagnostics.
✅ Passed checks (10 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: skipping CLI/VMDP download setup when the Console CRD is absent, directly matching the files modified and the core objective.
Description check ✅ Passed The description follows the template structure with complete 'Why' and 'How to test' sections, providing context, the issue link, root cause analysis, and detailed testing instructions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Test names are stable, deterministic, and descriptive without dynamic information, using standard Go testing with table-driven tests.
Microshift Test Compatibility ✅ Passed The pull request adds only standard Go unit tests, not Ginkgo e2e tests. The custom check applies only to new Ginkgo e2e tests, so it is not applicable here.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request does not add any Ginkgo e2e tests. The only test added is a standard Go unit test in internal/controller/console_test.go using testing.T framework.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds conditional CRD availability checks without introducing any topology-unaware scheduling constraints, affinity rules, nodeSelectors, or replica assumptions.
Ote Binary Stdout Contract ✅ Passed The pull request does not violate the OTE Binary Stdout Contract. All logging in process-level code uses the properly configured zap logger which writes to stderr by default, not stdout.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only a standard Go unit test, not a Ginkgo e2e test, so the custom check does not apply.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@Joeavaikath Joeavaikath requested review from kaovilai and mpryc and removed request for mpryc April 21, 2026 18:45
@Joeavaikath
Copy link
Copy Markdown
Contributor Author

/cherry-pick oadp-1.6

@openshift-ci openshift-ci Bot requested review from mpryc and mrnold April 21, 2026 18:46
@openshift-cherrypick-robot
Copy link
Copy Markdown
Contributor

@Joeavaikath: once the present PR merges, I will cherry-pick it on top of oadp-1.6 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick oadp-1.6

Instructions 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.

@weshayutin
Copy link
Copy Markdown
Contributor

this is good and should fix the bug. Ping me in slack as I'd also like to know how users can choose to turn off the running download servers.

@weshayutin
Copy link
Copy Markdown
Contributor

this also makes me wonder if it's time to setup a SNO testing job here in prow

@Joeavaikath
Copy link
Copy Markdown
Contributor Author

INFO  vmdp-download-setup  ConsoleCLIDownload CRD not available (Console capability not enabled), skipping setup     
INFO  cli-download-setup   ConsoleCLIDownload CRD not available (Console capability not enabled), skipping setup 

Comment thread internal/controller/vmdp_download_controller.go Outdated
Signed-off-by: Joseph <jvaikath@redhat.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Joeavaikath, shubham-pampattiwar, weshayutin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [shubham-pampattiwar]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 21, 2026
Copy link
Copy Markdown
Member

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2665425 and 2 for PR HEAD 9aa2d02 in total

@Joeavaikath
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-merge-bot openshift-merge-bot Bot merged commit c927a46 into openshift:oadp-dev Apr 22, 2026
14 of 15 checks passed
@openshift-cherrypick-robot
Copy link
Copy Markdown
Contributor

@Joeavaikath: new pull request created: #2173

Details

In response to this:

/cherry-pick oadp-1.6

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants