feat: add flag to force fallback to legacy upgrade

Forcing fallback to legacy flow, might be wanted by some users.

Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com>
(cherry picked from commit 7b6ab0c1c3cec7b6260e27dd5b6e72faa1975ab0)
This commit is contained in:
Mateusz Urbanek 2026-04-03 07:40:32 +02:00 committed by Andrey Smirnov
parent 8499579f4a
commit 70c356bfda
No known key found for this signature in database
GPG Key ID: 322C6F63F594CE7C
2 changed files with 10 additions and 2 deletions

View File

@ -41,6 +41,7 @@ var upgradeCmdFlags = struct {
rebootMode flags.PflagExtended[machine.RebootRequest_Mode]
progress flags.PflagExtended[reporter.OutputMode]
legacy bool
force bool // Deprecated: only used for legacy upgrade path, to be removed in Talos 1.18.
insecure bool // Deprecated: only used for legacy upgrade path, to be removed in Talos 1.18.
preserve bool // Deprecated: only used for legacy upgrade path, to be removed in Talos 1.18.
@ -82,6 +83,12 @@ func upgradeViaLifecycleService(ctx context.Context, c *client.Client, nodes []s
upgradeCmdFlags.wait = true
}
if upgradeCmdFlags.legacy {
cli.Warning("Forcing use of legacy upgrade method. This flag is deprecated and will be removed in Talos 1.18.")
return upgradeLegacy()
}
opts := []client.RebootMode{
client.WithRebootMode(upgradeCmdFlags.rebootMode.Value()),
}
@ -325,6 +332,7 @@ func init() {
//
// Note: remove me in Talos 1.18.
upgradeCmdFlags.addTrackActionFlags(upgradeCmd)
upgradeCmd.Flags().BoolVar(&upgradeCmdFlags.legacy, "legacy", false, "force use of legacy upgrade method")
upgradeCmd.Flags().BoolVarP(&upgradeCmdFlags.force, "force", "f", false, "force the upgrade (skip checks on etcd health and members, might lead to data loss)")
upgradeCmd.Flags().BoolVar(&upgradeCmdFlags.insecure, "insecure", false, "upgrade using the insecure (encrypted with no auth) maintenance service")
upgradeCmd.Flags().BoolVarP(&upgradeCmdFlags.preserve, "preserve", "p", false, "preserve data")

View File

@ -2932,7 +2932,7 @@ for e.g. Wireguard tunnels:
As packet capture is transmitted over the network, it is recommended to filter out the Talos API traffic,
e.g. by excluding packets with the port 50000.
```
### Options
@ -3332,6 +3332,7 @@ talosctl upgrade [flags]
-e, --endpoints strings override default endpoints in Talos configuration
-h, --help help for upgrade
-i, --image string the container image to use for performing the install (default "ghcr.io/siderolabs/installer:v1.13.0-beta.1")
--legacy force use of legacy upgrade method
--namespace string namespace to use: "system" (etcd and kubelet images), "cri" for all Kubernetes workloads, "inmem" for in-memory containerd instance (default "system")
-n, --nodes strings target the specified nodes
--progress string output mode for upgrade progress. Values: [auto plain] (default "auto")
@ -3587,4 +3588,3 @@ A CLI for out-of-band management of Kubernetes nodes created by Talos
* [talosctl validate](#talosctl-validate) - Validate config
* [talosctl version](#talosctl-version) - Prints the version
* [talosctl wipe](#talosctl-wipe) - Wipe block device or volumes