Skip to content

Commit b74a129

Browse files
committed
pkg/cli/admin/upgrade/recommend: Don't error on unaccepted issues when the feature gate is off
When OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT is not set to true, the --accept option does not exist. In that case, we don't want to error with [1]: error: issues that apply to this cluster but which were not included in --accept: ConditionalUpdateRisk Instead, we just want to exit happily, because we've already mentioned the issue earlier in the message. [1]: https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/29831/pull-ci-openshift-origin-main-e2e-aws-ovn-serial-1of2/1951653929842380800
1 parent ea45cd5 commit b74a129

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-not-recommended.version-4.12.51-output

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ Reason: MultipleReasons
1515
Message: An unintended reversion to the default kubelet nodeStatusReportFrequency can cause significant load on the control plane. https://issues.redhat.com/browse/MCO-1094
1616

1717
After rebooting into kernel-4.18.0-372.88.1.el8_6 or later, kernel nodes experience high load average and io_wait times. The nodes might fail to start or stop pods and probes may fail. Workload and host processes may become unresponsive and workload may be disrupted. https://issues.redhat.com/browse/COS-2705
18-
19-
error: issues that apply to this cluster but which were not included in --accept: AlertNoTestData,ConditionalUpdateRisk

pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-recommended.version-4.12.51-output

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ Reason: MultipleReasons
1515
Message: An unintended reversion to the default kubelet nodeStatusReportFrequency can cause significant load on the control plane. https://issues.redhat.com/browse/MCO-1094
1616

1717
After rebooting into kernel-4.18.0-372.88.1.el8_6 or later, kernel nodes experience high load average and io_wait times. The nodes might fail to start or stop pods and probes may fail. Workload and host processes may become unresponsive and workload may be disrupted. https://issues.redhat.com/browse/COS-2705
18-
19-
error: issues that apply to this cluster but which were not included in --accept: AlertNoTestData,ConditionalUpdateRisk

pkg/cli/admin/upgrade/recommend/examples/4.16.27-degraded-monitoring.version-4.16.32-output

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ Channel: candidate-4.16 (available channels: candidate-4.16, candidate-4.17, can
2323
Update to 4.16.32 has no known issues relevant to this cluster.
2424
Image: quay.io/openshift-release-dev/ocp-release@sha256:0e71cb61694473b40e8d95f530eaf250a62616debb98199f31b4034808687dae
2525
Release URL: https://access.redhat.com/errata/RHSA-2025:0650
26-
27-
error: issues that apply to this cluster but which were not included in --accept: ClusterOperatorDown,Failing,PodDisruptionBudgetAtLimit

pkg/cli/admin/upgrade/recommend/recommend.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,12 @@ func (o *options) Run(ctx context.Context) error {
342342
issues.Insert("ConditionalUpdateRisk")
343343
}
344344
unaccepted := issues.Difference(accept)
345-
if unaccepted.Len() > 0 {
346-
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
347-
} else if issues.Len() > 0 && !o.quiet {
348-
fmt.Fprintf(o.Out, "Update to %s has no known issues relevant to this cluster other than the accepted %s.\n", update.Release.Version, strings.Join(sets.List(issues), ","))
345+
if kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT").IsEnabled() {
346+
if unaccepted.Len() > 0 {
347+
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
348+
} else if issues.Len() > 0 && !o.quiet {
349+
fmt.Fprintf(o.Out, "Update to %s has no known issues relevant to this cluster other than the accepted %s.\n", update.Release.Version, strings.Join(sets.List(issues), ","))
350+
}
349351
}
350352
return nil
351353
}

0 commit comments

Comments
 (0)