Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
pkg/cli/admin/upgrade: --to-image --allow-explicit-upgrade and known …
…update targets

When folks use --to-image and --allow-explicit-upgrade together, oc
searches through recommended (and, with --allow-explicit-upgrade, also
supported but not recommended) targets to see if it knew about the
requested target image.

Until this commit, it would throw out that information, create an
Update that just pointed at the target release image, and warn the
user about the risks of --allow-explicit-upgrade.

With this commit, --allow-explicit-upgrade is consumed conditionally.
If we need it, because the earlier image search was unable to turn up
the requested release in ClusterVersion status, we'll still create an
Update and warn about the risks of --allow-explicit-upgrade.  But if
the search found the requested image (update != nil), we just use that
as if the user had requested it with --to, and we no longer pester the
user with complaints about the --allow-explicit-upgrade that they used
but, in this case, didn't need.
  • Loading branch information
wking committed Apr 14, 2022
commit dd48aa48fc54413c7522e465018d8cfc83ebc74f
14 changes: 6 additions & 8 deletions pkg/cli/admin/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,13 @@ func (o *Options) Run() error {
}
}

if o.ToImage != "" {
if o.AllowExplicitUpgrade {
update = &configv1.Update{
Version: "",
Image: o.ToImage,
}
fmt.Fprintln(o.ErrOut, "warning: The requested upgrade image is not one of the available updates."+
"You have used --allow-explicit-upgrade for the update to proceed anyway")
if update == nil && o.ToImage != "" && o.AllowExplicitUpgrade {
update = &configv1.Update{
Version: "",
Image: o.ToImage,
}
fmt.Fprintln(o.ErrOut, "warning: The requested upgrade image is not one of the available updates."+
"You have used --allow-explicit-upgrade for the update to proceed anyway")
}

if update == nil {
Expand Down