From 8bdac163b5acb939f45c1ee125dd870dd76312e4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 3 Sep 2025 15:16:55 -0700 Subject: [PATCH] pkg/cli/admin/upgrade/recommend: Enable precheck and accept gates To make that functionality generally available. This could be a more thorough overhaul, e.g. I could drop the precheckEnabled knob entirely. But I'm doing the smallest possible pivot now, in case folks want to backport to older 4.y. And I can do the dev-branch polishing later on. The: error: issues that apply to this cluster but which were not included in --accept: AlertNoTestData,ConditionalUpdateRisk output that b74a129723 (pkg/cli/admin/upgrade/recommend: Don't error on unaccepted issues when the feature gate is off, 2025-08-02, #2069) had removed from the test fixtures is back, now that the accept gate is enabled by default (and thus newly enabled for the test suite). --- ...gest-not-recommended.version-4.12.51-output | 2 ++ ...-longest-recommended.version-4.12.51-output | 2 ++ ...-degraded-monitoring.version-4.16.32-output | 2 ++ pkg/cli/admin/upgrade/recommend/recommend.go | 18 +++++++----------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-not-recommended.version-4.12.51-output b/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-not-recommended.version-4.12.51-output index 284d1fe887..59eca3e98c 100644 --- a/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-not-recommended.version-4.12.51-output +++ b/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-not-recommended.version-4.12.51-output @@ -15,3 +15,5 @@ Reason: MultipleReasons Message: An unintended reversion to the default kubelet nodeStatusReportFrequency can cause significant load on the control plane. https://issues.redhat.com/browse/MCO-1094 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 + +error: issues that apply to this cluster but which were not included in --accept: AlertNoTestData,ConditionalUpdateRisk diff --git a/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-recommended.version-4.12.51-output b/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-recommended.version-4.12.51-output index e9a04639be..1ab0f01697 100644 --- a/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-recommended.version-4.12.51-output +++ b/pkg/cli/admin/upgrade/recommend/examples/4.12.16-longest-recommended.version-4.12.51-output @@ -15,3 +15,5 @@ Reason: MultipleReasons Message: An unintended reversion to the default kubelet nodeStatusReportFrequency can cause significant load on the control plane. https://issues.redhat.com/browse/MCO-1094 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 + +error: issues that apply to this cluster but which were not included in --accept: AlertNoTestData,ConditionalUpdateRisk diff --git a/pkg/cli/admin/upgrade/recommend/examples/4.16.27-degraded-monitoring.version-4.16.32-output b/pkg/cli/admin/upgrade/recommend/examples/4.16.27-degraded-monitoring.version-4.16.32-output index d0fa755c1b..d730bae949 100644 --- a/pkg/cli/admin/upgrade/recommend/examples/4.16.27-degraded-monitoring.version-4.16.32-output +++ b/pkg/cli/admin/upgrade/recommend/examples/4.16.27-degraded-monitoring.version-4.16.32-output @@ -23,3 +23,5 @@ Channel: candidate-4.16 (available channels: candidate-4.16, candidate-4.17, can Update to 4.16.32 has no known issues relevant to this cluster. Image: quay.io/openshift-release-dev/ocp-release@sha256:0e71cb61694473b40e8d95f530eaf250a62616debb98199f31b4034808687dae Release URL: https://access.redhat.com/errata/RHSA-2025:0650 + +error: issues that apply to this cluster but which were not included in --accept: ClusterOperatorDown,Failing,PodDisruptionBudgetAtLimit diff --git a/pkg/cli/admin/upgrade/recommend/recommend.go b/pkg/cli/admin/upgrade/recommend/recommend.go index d066743783..0a39bc1994 100644 --- a/pkg/cli/admin/upgrade/recommend/recommend.go +++ b/pkg/cli/admin/upgrade/recommend/recommend.go @@ -62,10 +62,8 @@ func New(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command flags.BoolVar(&o.showOutdatedReleases, "show-outdated-releases", o.showOutdatedReleases, "Display additional older releases. These releases may be exposed to known issues which have been fixed in more recent releases. But all updates will contain fixes not present in your current release.") flags.StringVar(&o.rawVersion, "version", o.rawVersion, "Select a particular target release to display by version.") - if kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT").IsEnabled() { - flags.BoolVar(&o.quiet, "quiet", o.quiet, "When --quiet is true and --version is set, only print unaccepted issue names.") - flags.StringSliceVar(&o.accept, "accept", o.accept, "Comma-delimited names for issues that you find acceptable. With --version, any unaccepted issues will result in a non-zero exit code.") - } + flags.BoolVar(&o.quiet, "quiet", o.quiet, "When --quiet is true and --version is set, only print unaccepted issue names.") + flags.StringSliceVar(&o.accept, "accept", o.accept, "Comma-delimited names for issues that you find acceptable. With --version, any unaccepted issues will result in a non-zero exit code.") flags.StringVar(&o.mockData.cvPath, "mock-clusterversion", "", "Path to a YAML ClusterVersion object to use for testing (will be removed later).") flags.MarkHidden("mock-clusterversion") @@ -136,7 +134,7 @@ func (o *options) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string } } - o.precheckEnabled = kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_PRECHECK").IsEnabled() + o.precheckEnabled = true return nil } @@ -343,12 +341,10 @@ func (o *options) Run(ctx context.Context) error { issues.Insert("ConditionalUpdateRisk") } unaccepted := issues.Difference(accept) - if kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT").IsEnabled() { - if unaccepted.Len() > 0 { - return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ",")) - } else if issues.Len() > 0 && !o.quiet { - 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), ",")) - } + if unaccepted.Len() > 0 { + return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ",")) + } else if issues.Len() > 0 && !o.quiet { + 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), ",")) } return nil }