Skip to content

Commit f7c9fc3

Browse files
Merge pull request #2088 from wking/enable-oc-adm-upgrade-recommend-alert-and-accept
OCPBUGS-61063: pkg/cli/admin/upgrade/recommend: Enable precheck and accept gates
2 parents 6edd9e4 + 8bdac16 commit f7c9fc3

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ 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: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ func New(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
6262
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.")
6363
flags.StringVar(&o.rawVersion, "version", o.rawVersion, "Select a particular target release to display by version.")
6464

65-
if kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT").IsEnabled() {
66-
flags.BoolVar(&o.quiet, "quiet", o.quiet, "When --quiet is true and --version is set, only print unaccepted issue names.")
67-
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.")
68-
}
65+
flags.BoolVar(&o.quiet, "quiet", o.quiet, "When --quiet is true and --version is set, only print unaccepted issue names.")
66+
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.")
6967

7068
flags.StringVar(&o.mockData.cvPath, "mock-clusterversion", "", "Path to a YAML ClusterVersion object to use for testing (will be removed later).")
7169
flags.MarkHidden("mock-clusterversion")
@@ -136,7 +134,7 @@ func (o *options) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string
136134
}
137135
}
138136

139-
o.precheckEnabled = kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_PRECHECK").IsEnabled()
137+
o.precheckEnabled = true
140138

141139
return nil
142140
}
@@ -343,12 +341,10 @@ func (o *options) Run(ctx context.Context) error {
343341
issues.Insert("ConditionalUpdateRisk")
344342
}
345343
unaccepted := issues.Difference(accept)
346-
if kcmdutil.FeatureGate("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT").IsEnabled() {
347-
if unaccepted.Len() > 0 {
348-
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
349-
} else if issues.Len() > 0 && !o.quiet {
350-
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), ","))
351-
}
344+
if unaccepted.Len() > 0 {
345+
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
346+
} else if issues.Len() > 0 && !o.quiet {
347+
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), ","))
352348
}
353349
return nil
354350
}

0 commit comments

Comments
 (0)