v1.27.1 CLI Deprecation (#7311)

* Remove Flannel Wireguard
* Remove etcd-snapshot (implicit save)
* Convert ipsec and multiple backend to fatal

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola 2023-04-19 12:02:05 -07:00 committed by GitHub
parent f2bde63eea
commit 944f811dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 39 deletions

View File

@ -16,7 +16,6 @@ func main() {
app := cmds.NewApp() app := cmds.NewApp()
app.Commands = []cli.Command{ app.Commands = []cli.Command{
cmds.NewEtcdSnapshotCommands( cmds.NewEtcdSnapshotCommands(
etcdsnapshot.Run,
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune, etcdsnapshot.Prune,

View File

@ -63,7 +63,6 @@ func main() {
etcdsnapshotCommand, etcdsnapshotCommand,
etcdsnapshotCommand, etcdsnapshotCommand,
etcdsnapshotCommand, etcdsnapshotCommand,
etcdsnapshotCommand,
), ),
cmds.NewSecretsEncryptCommands( cmds.NewSecretsEncryptCommands(
secretsencryptCommand, secretsencryptCommand,

View File

@ -56,7 +56,6 @@ func main() {
token.List, token.List,
), ),
cmds.NewEtcdSnapshotCommands( cmds.NewEtcdSnapshotCommands(
etcdsnapshot.Run,
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune, etcdsnapshot.Prune,

View File

@ -33,7 +33,6 @@ func main() {
cmds.NewKubectlCommand(kubectl.Run), cmds.NewKubectlCommand(kubectl.Run),
cmds.NewCRICTL(crictl.Run), cmds.NewCRICTL(crictl.Run),
cmds.NewEtcdSnapshotCommands( cmds.NewEtcdSnapshotCommands(
etcdsnapshot.Run,
etcdsnapshot.Delete, etcdsnapshot.Delete,
etcdsnapshot.List, etcdsnapshot.List,
etcdsnapshot.Prune, etcdsnapshot.Prune,

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"fmt" "fmt"
"net" "net"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
@ -201,16 +200,7 @@ func createFlannelConf(nodeConfig *config.Node) error {
backend := parts[0] backend := parts[0]
backendOptions := make(map[string]string) backendOptions := make(map[string]string)
if len(parts) > 1 { if len(parts) > 1 {
logrus.Warnf("The additional options through flannel-backend are deprecated and will be removed in k3s v1.27, use flannel-conf instead") logrus.Fatalf("The additional options through flannel-backend are deprecated and were removed in k3s v1.27, use flannel-conf instead")
options := strings.Split(parts[1], ",")
for _, o := range options {
p := strings.SplitN(o, "=", 2)
if len(p) == 1 {
backendOptions[p[0]] = ""
} else {
backendOptions[p[0]] = p[1]
}
}
} }
switch backend { switch backend {
@ -219,13 +209,7 @@ func createFlannelConf(nodeConfig *config.Node) error {
case config.FlannelBackendHostGW: case config.FlannelBackendHostGW:
backendConf = hostGWBackend backendConf = hostGWBackend
case config.FlannelBackendIPSEC: case config.FlannelBackendIPSEC:
backendConf = strings.ReplaceAll(ipsecBackend, "%psk%", nodeConfig.AgentConfig.IPSECPSK) logrus.Fatal("The ipsec backend is deprecated and was removed in k3s v1.27; please switch to wireguard-native. Check our docs for information on how to migrate.")
if _, err := exec.LookPath("swanctl"); err != nil {
return errors.Wrap(err, "k3s no longer includes strongswan - please install strongswan's swanctl and charon packages on your host")
}
logrus.Warnf("The ipsec backend is deprecated and will be removed in k3s v1.27; please switch to wireguard-native. Check our docs for information on how to migrate.")
case config.FlannelBackendWireguard:
logrus.Fatalf("The wireguard backend was deprecated in K3s v1.26, please switch to wireguard-native. Check our docs at docs.k3s.io/installation/network-options for information about how to migrate.")
case config.FlannelBackendWireguardNative: case config.FlannelBackendWireguardNative:
mode, ok := backendOptions["Mode"] mode, ok := backendOptions["Mode"]
if !ok { if !ok {

View File

@ -99,14 +99,21 @@ var EtcdSnapshotFlags = []cli.Flag{
}, },
} }
func NewEtcdSnapshotCommands(run, delete, list, prune, save func(ctx *cli.Context) error) cli.Command { func NewEtcdSnapshotCommands(delete, list, prune, save func(ctx *cli.Context) error) cli.Command {
return cli.Command{ return cli.Command{
Name: EtcdSnapshotCommand, Name: EtcdSnapshotCommand,
Usage: "Trigger an immediate etcd snapshot", Usage: "Trigger an immediate etcd snapshot",
SkipFlagParsing: false, SkipFlagParsing: false,
SkipArgReorder: true, SkipArgReorder: true,
Action: run,
Subcommands: []cli.Command{ Subcommands: []cli.Command{
{
Name: "save",
Usage: "Trigger an immediate etcd snapshot",
SkipFlagParsing: false,
SkipArgReorder: true,
Action: save,
Flags: EtcdSnapshotFlags,
},
{ {
Name: "delete", Name: "delete",
Usage: "Delete given snapshot(s)", Usage: "Delete given snapshot(s)",
@ -141,14 +148,6 @@ func NewEtcdSnapshotCommands(run, delete, list, prune, save func(ctx *cli.Contex
Value: defaultSnapshotRentention, Value: defaultSnapshotRentention,
}), }),
}, },
{
Name: "save",
Usage: "Trigger an immediate etcd snapshot",
SkipFlagParsing: false,
SkipArgReorder: true,
Action: save,
Flags: EtcdSnapshotFlags,
},
}, },
Flags: EtcdSnapshotFlags, Flags: EtcdSnapshotFlags,
} }

View File

@ -69,12 +69,6 @@ func commandSetup(app *cli.Context, cfg *cmds.Server, sc *server.Config) error {
return nil return nil
} }
// Run was an alias for Save
func Run(app *cli.Context) error {
cli.ShowAppHelp(app)
return fmt.Errorf("saving with etcd-snapshot was deprecated in v1.26, use \"etcd-snapshot save\" instead")
}
// Save triggers an on-demand etcd snapshot operation // Save triggers an on-demand etcd snapshot operation
func Save(app *cli.Context) error { func Save(app *cli.Context) error {
if err := cmds.InitLogging(); err != nil { if err := cmds.InitLogging(); err != nil {

View File

@ -24,7 +24,6 @@ const (
FlannelBackendVXLAN = "vxlan" FlannelBackendVXLAN = "vxlan"
FlannelBackendHostGW = "host-gw" FlannelBackendHostGW = "host-gw"
FlannelBackendIPSEC = "ipsec" FlannelBackendIPSEC = "ipsec"
FlannelBackendWireguard = "wireguard"
FlannelBackendWireguardNative = "wireguard-native" FlannelBackendWireguardNative = "wireguard-native"
EgressSelectorModeAgent = "agent" EgressSelectorModeAgent = "agent"
EgressSelectorModeCluster = "cluster" EgressSelectorModeCluster = "cluster"