Skip to content

Commit a46ebc2

Browse files
committed
pkg/cli/admin/upgrade: Tighten force warnings
Catching the --help and stderr warnings for --force up with the recent openshift/api@b618d5bd8c (config/v1/types_cluster_version: Tighten force and rollback warnings, 2025-10-18, openshift/api#2539) wording.
1 parent 9ae657d commit a46ebc2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pkg/cli/admin/upgrade/upgrade.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,15 @@ func New(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
9393
regardless of these concerns, use --allow-upgrade-with-warnings.
9494
9595
Cluster-side guards include checks for release verification and upgradeable conditions.
96-
Again, it is usually best to give these conditions time to resolve, or to actively work to
97-
resolve them. But if you decide to trigger the update regardless of these concerns,
98-
use --force, which is passed through to ClusterVersion's spec.desiredUpdate.force.
96+
You can push through them with --force, which is passed through to ClusterVersion's
97+
spec.desiredUpdate.force, but only do that if:
98+
99+
* you are testing unsigned release images in short-lived test clusters or
100+
* you are working around a known bug in the cluster-version operator and you have verified
101+
the authenticity of the provided image yourself.
102+
103+
The provided image will run with full administrative access to the cluster. Do not use
104+
--force with images that come from unknown or potentially malicious sources.
99105
`),
100106
Run: func(cmd *cobra.Command, args []string) {
101107
kcmdutil.CheckErr(o.Complete(f, cmd, args))
@@ -108,7 +114,7 @@ func New(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command
108114
flags.BoolVar(&o.ToLatestAvailable, "to-latest", o.ToLatestAvailable, "Use the latest (highest Semantic Version) available version.")
109115
flags.BoolVar(&o.ToMultiArch, "to-multi-arch", o.ToMultiArch, "Upgrade current version to multi architecture.")
110116
flags.BoolVar(&o.Clear, "clear", o.Clear, "If an upgrade has been requested but not yet downloaded, cancel the update. This has no effect once the update has started.")
111-
flags.BoolVar(&o.Force, "force", o.Force, "Upgrade regardless of cluster-side guard failures, such as release verification or upgradeable conditions.")
117+
flags.BoolVar(&o.Force, "force", o.Force, "Upgrade regardless of cluster-side guard failures, such as release verification or upgradeable conditions. Only use this if you are testing unsigned release images or you are working around a known bug in the cluster-version operator and you have verified the authenticity of the provided image yourself.")
112118
flags.BoolVar(&o.AllowExplicitUpgrade, "allow-explicit-upgrade", o.AllowExplicitUpgrade, "Upgrade even if the upgrade target is not listed in the available versions list.")
113119
flags.BoolVar(&o.AllowUpgradeWithWarnings, "allow-upgrade-with-warnings", o.AllowUpgradeWithWarnings, "Upgrade regardless of client-side guard failures, such as upgrades in progress or failing clusters.")
114120
flags.BoolVar(&o.IncludeNotRecommended, "include-not-recommended", o.IncludeNotRecommended, "Display additional updates which are not recommended based on your cluster configuration.")
@@ -243,7 +249,7 @@ func (o *Options) Run() error {
243249

244250
if o.Force {
245251
update.Force = true
246-
fmt.Fprintln(o.ErrOut, "warning: --force overrides cluster verification of your supplied release image and waives any update precondition failures.")
252+
fmt.Fprintln(o.ErrOut, "warning: --force overrides cluster verification of your supplied release image and waives any update precondition failures. Only use this if you are testing unsigned release images or you are working around a known bug in the cluster-version operator and you have verified the authenticity of the provided image yourself.")
247253
}
248254

249255
if err := patchDesiredUpdate(ctx, update, o.Client, cv.Name); err != nil {
@@ -375,7 +381,7 @@ func (o *Options) Run() error {
375381

376382
if o.Force {
377383
update.Force = true
378-
fmt.Fprintln(o.ErrOut, "warning: --force overrides cluster verification of your supplied release image and waives any update precondition failures.")
384+
fmt.Fprintln(o.ErrOut, "warning: --force overrides cluster verification of your supplied release image and waives any update precondition failures. Only use this if you are testing unsigned release images or you are working around a known bug in the cluster-version operator and you have verified the authenticity of the provided image yourself.")
379385
}
380386

381387
if err := checkForUpgrade(cv); err != nil {

0 commit comments

Comments
 (0)