Skip to content

fix(alerts): Remove duplicate information in the recommend command#2279

Open
nbottari9 wants to merge 4 commits into
openshift:mainfrom
nbottari9:1814-duplicate-warning
Open

fix(alerts): Remove duplicate information in the recommend command#2279
nbottari9 wants to merge 4 commits into
openshift:mainfrom
nbottari9:1814-duplicate-warning

Conversation

@nbottari9

@nbottari9 nbottari9 commented Jun 4, 2026

Copy link
Copy Markdown

Context


If the ClusterUpdateAcceptRisks feature gate is enabled on the cluster, the CVO will include alerts in the conditional update risks. The client also checks for alerts, which can cause warnings or info messages to be printed twice.

Description


We can detect if the server (CVO) is already including alerts by checking if Recommended=False in the ClusterVersion conditional updates. If this is set, we know that the feature gate is enabled, therefore the server is checking alerts and we don't need to on the client.

Changes


  • Added an if statement before calling precheck() to check if the server is including alerts
  • shouldSkipClientAlertChecking() - loops over the ConditionalUpdates and checks to see if any of them have Recommended=False. If so, return true to indicate the server IS checking for alerts and we don't need to on the client.
  • TestServerSideAlertRisks test suite - Added new tests to test new functionality

Summary by CodeRabbit

  • Bug Fixes

    • The upgrade recommendation command now detects cluster feature gates and hypershift usage to avoid unnecessary client-side alert/precheck evaluation when update risks are accepted and hypershift is not in use.
  • Tests

    • Added unit tests covering feature-gate and hypershift detection helper behaviors used by the recommendation alert logic.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The alerts function now detects when the ClusterUpdateAcceptRisks feature gate is enabled and hypershift is not in use; under those conditions, it returns early to skip client-side alert evaluation. Two helper functions inspect cluster FeatureGate and Infrastructure state to determine these conditions, and new unit tests validate the helper behavior.

Changes

Conditional alert checking based on feature gates and hypershift

Layer / File(s) Summary
Helper functions and detection tests
pkg/cli/admin/upgrade/recommend/alerts.go, pkg/cli/admin/upgrade/recommend/recommend_test.go
Import OpenShift config API types and feature-gate constants; implement isAcceptRisksEnabled(featureGate, clusterVersion) and isHypershiftEnabled(infrastructure) helpers to inspect feature gate state and cluster topology; add unit tests validating helper behavior with constructed FeatureGate and Infrastructure objects.
Alert function early-return integration
pkg/cli/admin/upgrade/recommend/alerts.go
Fetch cluster FeatureGate and Infrastructure config resources and return nil early when ClusterUpdateAcceptRisks is enabled and hypershift is not enabled, bypassing alert retrieval and parsing.
Non-semantic formatting adjustment
pkg/cli/admin/upgrade/recommend/recommend.go
Line-anchor adjustment near options.Complete return path with no functional change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title does not align with the actual implementation. The PR description states the solution involves detecting server-side alert checking via Recommended=False in ConditionalUpdates, but the actual changes implement feature gate and hypershift detection instead. Update the title to accurately reflect the implementation, such as 'fix(alerts): Skip client-side alert checking when ClusterUpdateAcceptRisks feature gate is enabled and hypershift is not in use' or similar.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 The PR adds test functions using Go's standard testing package (not Ginkgo), with test names: TestIsAcceptRisksEnabled, TestIsHypershiftEnabled, and TestSortConditionalUpdatesBySemanticVersions. Al...
Test Structure And Quality ✅ Passed The custom check for Ginkgo test quality is not applicable. The PR adds standard Go tests (TestIsAcceptRisksEnabled, TestIsHypershiftEnabled) using the 'testing' package, not Ginkgo framework.
Microshift Test Compatibility ✅ Passed The PR adds only standard Go unit tests (TestIsAcceptRisksEnabled, TestIsHypershiftEnabled), not Ginkgo e2e tests. The check explicitly applies only to Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds only standard Go unit tests (TestIsAcceptRisksEnabled, TestIsHypershiftEnabled using *testing.T), not Ginkgo e2e tests. The check applies only to Ginkgo tests (It(), Describe(), etc.), whic...
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only CLI command code (pkg/cli/admin/upgrade/recommend/) with no deployment manifests, operator code, controllers, or scheduling constraints introduced; check applies only to workload s...
Ote Binary Stdout Contract ✅ Passed The PR modifies CLI command code in pkg/cli/admin/upgrade/recommend/, not OTE test binaries. These files are part of the oc CLI tool's recommend subcommand and contain no process-level stdout write...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added. PR contains only standard Go unit tests (TestIsAcceptRisksEnabled, TestIsHypershiftEnabled) using testing.T with no external connectivity or IPv4 assumptions.
No-Weak-Crypto ✅ Passed No weak cryptographic algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or non-constant-time secret comparisons found in the pull request files.
Container-Privileges ✅ Passed PR modifies only Go source files in a CLI utility package; contains no Kubernetes manifests, Dockerfile, or container configurations that could trigger container-privileges checks.
No-Sensitive-Data-In-Logs ✅ Passed No new logging statements that expose sensitive data were added. The PR adds feature gate/hypershift detection logic and tests, with no log/print/fmt calls in new code.

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

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

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.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from ardaguclu and ingvagabund June 4, 2026 15:41
@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nbottari9
Once this PR has been reviewed and has the lgtm label, please assign hongkailiu for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

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

func shouldSkipClientAlertChecking(cv *configv1.ClusterVersion) bool {
for _, update := range cv.Status.ConditionalUpdates {
for _, condition := range update.Conditions {
if condition.Type == "Recommended" && condition.Status == metav1.ConditionFalse {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There could be reasons for an update to be Recommended=False that aren't about the alert checks. And we want to be exhaustive in checking, because a cluster-admin should be able to say "oh, I'm ok with those issues" and be able to confidently update anyway. Maybe we can look in conditionalUpdateRisks for risk names that start with Alert? Or maybe the presence of conditionalUpdateRisks at all is enough to mark the relevant feature as enabled, and we don't need to build heuristics based on risk name? Either of those might double-check a cluster where the CVO checked and thought the cluster was clean, and then the client re-checked (and hopefully agreed the cluster was clean), but that seems ok during the transitional period, before we can drop the client-side checking entirely.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Sorry for late comments)

CVO works on the risks with the above guard, including the ones from alerts.

Could we do similar guard in oc to CVO, like this?

It checks the feature gate and HyperShift: oc has the tools to receive both.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@pkg/cli/admin/upgrade/recommend/recommend.go`:
- Around line 187-190: The call to o.Client.ConfigV1().FeatureGates().Get(ctx,
"cluster", metav1.GetOptions{}) is ignoring its error return; capture the error
(e.g., err) instead of using `_` and log it with klog.V(4).Infof() (including
context like that the FeatureGate fetch failed) while keeping the existing nil
fallback behavior for featureGate; update the block that references featureGate
and o.Client to handle the captured error and log it appropriately.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 260e5e72-5faa-490c-859c-5290a98e1dc7

📥 Commits

Reviewing files that changed from the base of the PR and between fb98845 and 0a14aba.

📒 Files selected for processing (1)
  • pkg/cli/admin/upgrade/recommend/recommend.go

Comment thread pkg/cli/admin/upgrade/recommend/recommend.go Outdated
// if CVO is present in the cluster,
// and Hypershift is not enabled,
// we don't need to check for alerts here
if !isAcceptRisksEnabled(featureGate, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In my mind, the guard will be inside the alert checking:

func (o *options) alerts(ctx context.Context) ([]acceptableCondition, error) {

Something like if the gate is enabled and not Hypershift, then the function returns nil, nil like there were no alerts to check (because they are checked by CVO already and CVO will generate the Recommend condition if needed).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pkg/cli/admin/upgrade/recommend/recommend_test.go (1)

34-67: ⚡ Quick win

Expand test coverage with table-driven tests.

These tests only cover the positive cases. Critical edge cases are missing: nil inputs, version mismatches, and feature-not-enabled scenarios. Table-driven tests would improve coverage and align with guidelines.

As per coding guidelines: "Unit tests should use co-located *_test.go files with table-driven tests."

♻️ Proposed table-driven tests
-func TestIsAcceptRisksEnabled(t *testing.T) {
-	featureGate := &configv1.FeatureGate{
-		Status: configv1.FeatureGateStatus{
-			FeatureGates: []configv1.FeatureGateDetails{
-				{
-					Version: "4.22.0",
-					Enabled: []configv1.FeatureGateAttributes{
-						{
-							Name: features.FeatureGateClusterUpdateAcceptRisks,
-						},
-					},
-				},
-			},
-		},
-	}
-
-	result := isAcceptRisksEnabled(featureGate, "4.22.0")
-	if result != true {
-		t.Errorf("ClusterUpdateAcceptRisks feature gate should report as enabled")
-	}
-}
-
-func TestIsHypershiftEnabled(t *testing.T) {
-	infra := &configv1.Infrastructure{
-		Status: configv1.InfrastructureStatus{
-			ControlPlaneTopology: configv1.ExternalTopologyMode,
-		},
-	}
-
-	result := isHypershiftEnabled(infra)
-	if result != true {
-		t.Errorf("Hypershift should report as enabled")
-	}
-}
+func TestIsAcceptRisksEnabled(t *testing.T) {
+	tests := []struct {
+		name           string
+		featureGate    *configv1.FeatureGate
+		clusterVersion string
+		want           bool
+	}{
+		{
+			name:           "nil feature gate",
+			featureGate:    nil,
+			clusterVersion: "4.22.0",
+			want:           false,
+		},
+		{
+			name: "feature gate enabled for matching version",
+			featureGate: &configv1.FeatureGate{
+				Status: configv1.FeatureGateStatus{
+					FeatureGates: []configv1.FeatureGateDetails{
+						{
+							Version: "4.22.0",
+							Enabled: []configv1.FeatureGateAttributes{
+								{Name: features.FeatureGateClusterUpdateAcceptRisks},
+							},
+						},
+					},
+				},
+			},
+			clusterVersion: "4.22.0",
+			want:           true,
+		},
+		{
+			name: "feature gate enabled for different version",
+			featureGate: &configv1.FeatureGate{
+				Status: configv1.FeatureGateStatus{
+					FeatureGates: []configv1.FeatureGateDetails{
+						{
+							Version: "4.21.0",
+							Enabled: []configv1.FeatureGateAttributes{
+								{Name: features.FeatureGateClusterUpdateAcceptRisks},
+							},
+						},
+					},
+				},
+			},
+			clusterVersion: "4.22.0",
+			want:           false,
+		},
+		{
+			name: "feature gate not in enabled list",
+			featureGate: &configv1.FeatureGate{
+				Status: configv1.FeatureGateStatus{
+					FeatureGates: []configv1.FeatureGateDetails{
+						{
+							Version: "4.22.0",
+							Enabled: []configv1.FeatureGateAttributes{
+								{Name: "SomeOtherFeature"},
+							},
+						},
+					},
+				},
+			},
+			clusterVersion: "4.22.0",
+			want:           false,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := isAcceptRisksEnabled(tt.featureGate, tt.clusterVersion)
+			if got != tt.want {
+				t.Errorf("isAcceptRisksEnabled() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestIsHypershiftEnabled(t *testing.T) {
+	tests := []struct {
+		name  string
+		infra *configv1.Infrastructure
+		want  bool
+	}{
+		{
+			name:  "nil infrastructure",
+			infra: nil,
+			want:  false,
+		},
+		{
+			name: "external topology mode (hypershift)",
+			infra: &configv1.Infrastructure{
+				Status: configv1.InfrastructureStatus{
+					ControlPlaneTopology: configv1.ExternalTopologyMode,
+				},
+			},
+			want: true,
+		},
+		{
+			name: "high availability mode",
+			infra: &configv1.Infrastructure{
+				Status: configv1.InfrastructureStatus{
+					ControlPlaneTopology: configv1.HighlyAvailableTopologyMode,
+				},
+			},
+			want: false,
+		},
+		{
+			name: "single replica mode",
+			infra: &configv1.Infrastructure{
+				Status: configv1.InfrastructureStatus{
+					ControlPlaneTopology: configv1.SingleReplicaTopologyMode,
+				},
+			},
+			want: false,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := isHypershiftEnabled(tt.infra)
+			if got != tt.want {
+				t.Errorf("isHypershiftEnabled() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
🤖 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 `@pkg/cli/admin/upgrade/recommend/recommend_test.go` around lines 34 - 67,
Refactor the TestIsAcceptRisksEnabled and TestIsHypershiftEnabled test functions
to use table-driven tests instead of single-case tests. The current tests only
cover positive scenarios and miss critical edge cases. For
TestIsAcceptRisksEnabled, add test cases for nil featureGate input, version
mismatches, disabled features, and empty feature gates. For
TestIsHypershiftEnabled, add test cases for nil infra input, different control
plane topology modes, and other edge conditions. Use a table structure with test
case names, input parameters, and expected results, then iterate through the
table to run each scenario.

Source: Coding guidelines

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

Inline comments:
In `@pkg/cli/admin/upgrade/recommend/alerts.go`:
- Around line 33-35: The condition checking cv == nil then attempting to
dereference cv.Status.Desired.Version will cause a nil pointer panic because cv
cannot be dereferenced when it is nil. Change the condition from cv == nil to cv
!= nil in the if statement at line 33 to ensure the ClusterVersion object is not
nil before accessing its Status.Desired.Version field in the
isAcceptRisksEnabled function call.
- Around line 27-29: The three API calls FeatureGates().Get(),
Infrastructures().Get(), and ClusterVersions().Get() are silently discarding
their error returns using the blank identifier. Instead of ignoring errors with
_, capture the error return values from each of these Get() calls and handle
them appropriately. Check each error and either log it, return it, or handle the
failure case explicitly so that network issues, RBAC denials, and other failures
are properly distinguished from successful operations rather than being silently
ignored.

---

Nitpick comments:
In `@pkg/cli/admin/upgrade/recommend/recommend_test.go`:
- Around line 34-67: Refactor the TestIsAcceptRisksEnabled and
TestIsHypershiftEnabled test functions to use table-driven tests instead of
single-case tests. The current tests only cover positive scenarios and miss
critical edge cases. For TestIsAcceptRisksEnabled, add test cases for nil
featureGate input, version mismatches, disabled features, and empty feature
gates. For TestIsHypershiftEnabled, add test cases for nil infra input,
different control plane topology modes, and other edge conditions. Use a table
structure with test case names, input parameters, and expected results, then
iterate through the table to run each scenario.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: a2529d24-e031-4cd3-ad50-33dc89d0cd7f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b30ec7 and fbe10c8.

📒 Files selected for processing (3)
  • pkg/cli/admin/upgrade/recommend/alerts.go
  • pkg/cli/admin/upgrade/recommend/recommend.go
  • pkg/cli/admin/upgrade/recommend/recommend_test.go

Comment thread pkg/cli/admin/upgrade/recommend/alerts.go Outdated
Comment thread pkg/cli/admin/upgrade/recommend/alerts.go Outdated
@nbottari9 nbottari9 force-pushed the 1814-duplicate-warning branch from 5e4859e to 8f28014 Compare June 15, 2026 15:26
…t test for new functions

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

fix(alerts): prevent duplication of warnings by disabling client-side alert checking if the server is already doing it.

Signed-off-by: Nick Bottari <nbottari@nbottari-thinkpadp1gen4i.boston.csb>

fix(adm-upgrade): changed method of detecting if CVO is already checking alerts

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

fix(adm-upgrade): add check for hypershift and improve error checking

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

fix(adm-upgrade): switched to checking for CVO in alerts(). Wrote unit test for new functions

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

cv != nil

Signed-off-by: Nick Bottari <nbottari9@gmail.com>
@nbottari9 nbottari9 force-pushed the 1814-duplicate-warning branch from d9a7f2a to 9cb58aa Compare June 15, 2026 15:29
Comment thread pkg/cli/admin/upgrade/recommend/recommend.go
Comment thread pkg/cli/admin/upgrade/recommend/alerts.go Outdated
Comment thread pkg/cli/admin/upgrade/recommend/recommend_test.go
Comment thread pkg/cli/admin/upgrade/recommend/recommend_test.go Outdated
Comment thread pkg/cli/admin/upgrade/recommend/alerts.go Outdated
Comment on lines +27 to +28
featureGates, _ := o.Client.ConfigV1().FeatureGates().Get(ctx, "cluster", metav1.GetOptions{})
infrastructure, _ := o.Client.ConfigV1().Infrastructures().Get(ctx, "cluster", metav1.GetOptions{})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

featureGates and infrastructure become inputs. So they should be integrated into mockData:

type mockData struct {
// inputs
cvPath string
alertsPath string

Then you can write up tests based on some new mocks.

…unction, added comprehensive tests for the 2 pure functions

Signed-off-by: Nick Bottari <nbottari9@gmail.com>
…Gates's and infrastructure's

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

fix(adm-upgrade-recommend-alerts): add test for different featureGate version

Signed-off-by: Nick Bottari <nbottari9@gmail.com>

add comma

Signed-off-by: Nick Bottari <nbottari9@gmail.com>
@nbottari9 nbottari9 force-pushed the 1814-duplicate-warning branch from b6b3fb2 to 05b6aaa Compare June 16, 2026 19:06

@hongkailiu hongkailiu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe it is pretty close.
Only a few of code refactoring for simplicity.

We are ready to take mock data from a cluster (HowTo is discussed over slack) and add them into examples and see if we do the output correctly.

Comment on lines +26 to +32
skip, err := o.alertsEvaluatedByCVO(ctx)
if err != nil {
klog.Warningf("An error occured while determining if the CVO is evaluating alerts, so the client will check. %v", err)
}
if skip {
return nil, nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: check skip only if err==nil.
If err!=nil (i.e., fail to determine if CVO does it already), oc does it anyway.

Suggested change
skip, err := o.alertsEvaluatedByCVO(ctx)
if err != nil {
klog.Warningf("An error occured while determining if the CVO is evaluating alerts, so the client will check. %v", err)
}
if skip {
return nil, nil
}
if skip, err := o.alertsEvaluatedByCVO(ctx); err != nil {
klog.Warningf("An error occured while determining if the CVO is evaluating alerts, so the client will check. %v", err)
} else if skip {
return nil, nil
}

Comment on lines +268 to +276
var featureGates *configv1.FeatureGate
var infrastructure *configv1.Infrastructure
var cv *configv1.ClusterVersion

if o.mockData.cvPath != "" {
featureGates = o.mockData.featureGate
infrastructure = o.mockData.infrastructure
cv = o.mockData.clusterVersion
} else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: it is a little simpler this way.

Suggested change
var featureGates *configv1.FeatureGate
var infrastructure *configv1.Infrastructure
var cv *configv1.ClusterVersion
if o.mockData.cvPath != "" {
featureGates = o.mockData.featureGate
infrastructure = o.mockData.infrastructure
cv = o.mockData.clusterVersion
} else {
featureGates := o.mockData.featureGate
infrastructure := o.mockData.infrastructure
cv := o.mockData.clusterVersion
if cv == nil {

}
}

// if the AcceptRisks feature gate AND hypershift is not enabled,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ref. https://hypershift.pages.dev/getting-started/quick-setup/

Suggested change
// if the AcceptRisks feature gate AND hypershift is not enabled,
// if the AcceptRisks feature gate enabled AND the oc is not running against a hosted cluster,


// if the AcceptRisks feature gate AND hypershift is not enabled,
// the CVO is handling alerts and will generate the Recommended condition if needed
if isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure) {
if isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !hostedCluster(infrastructure) {

Comment on lines +324 to +328
if i == nil {
return false
}

return i.Status.ControlPlaneTopology == configv1.ExternalTopologyMode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if i == nil {
return false
}
return i.Status.ControlPlaneTopology == configv1.ExternalTopologyMode
return i != nil && i.Status.ControlPlaneTopology == configv1.ExternalTopologyMode

Comment on lines +295 to +301
// the CVO is handling alerts and will generate the Recommended condition if needed
if isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure) {
return true, nil
}

// if we get to this point, check on the client anyway to be safe
return false, fmt.Errorf("Failed to detect presence of CVO and/or if Hypershift is enabled")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// the CVO is handling alerts and will generate the Recommended condition if needed
if isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure) {
return true, nil
}
// if we get to this point, check on the client anyway to be safe
return false, fmt.Errorf("Failed to detect presence of CVO and/or if Hypershift is enabled")
// the CVO is handling alerts and will generate the Recommended condition if needed
return isAcceptRisksEnabled(featureGates, cv.Status.Desired.Version) && !isHypershiftEnabled(infrastructure), nil

}{
{
name: "no infrastructure",
expected: false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: no need to set up zero value explicitly. It applies to other cases too.

Suggested change
expected: false,

Comment thread pkg/cli/admin/upgrade/recommend/recommend_test.go Outdated
Signed-off-by: Nick Bottari <nbottari9@gmail.com>
@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@nbottari9: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-serial-1of2 e61d937 link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-aws-ovn-upgrade e61d937 link true /test e2e-aws-ovn-upgrade
ci/prow/e2e-aws-ovn e61d937 link true /test e2e-aws-ovn

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants