From 944f811dc5341349372ccf57706f2aa65e13ce04 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Wed, 19 Apr 2023 12:02:05 -0700 Subject: [PATCH] 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 --- cmd/etcdsnapshot/main.go | 1 - cmd/k3s/main.go | 1 - cmd/server/main.go | 1 - main.go | 1 - pkg/agent/flannel/setup.go | 20 ++------------------ pkg/cli/cmds/etcd_snapshot.go | 19 +++++++++---------- pkg/cli/etcdsnapshot/etcd_snapshot.go | 6 ------ pkg/daemons/config/types.go | 1 - 8 files changed, 11 insertions(+), 39 deletions(-) diff --git a/cmd/etcdsnapshot/main.go b/cmd/etcdsnapshot/main.go index 28369468c20c..d6f8cb3a60c6 100644 --- a/cmd/etcdsnapshot/main.go +++ b/cmd/etcdsnapshot/main.go @@ -16,7 +16,6 @@ func main() { app := cmds.NewApp() app.Commands = []cli.Command{ cmds.NewEtcdSnapshotCommands( - etcdsnapshot.Run, etcdsnapshot.Delete, etcdsnapshot.List, etcdsnapshot.Prune, diff --git a/cmd/k3s/main.go b/cmd/k3s/main.go index cbe996703a54..edce8215d615 100644 --- a/cmd/k3s/main.go +++ b/cmd/k3s/main.go @@ -63,7 +63,6 @@ func main() { etcdsnapshotCommand, etcdsnapshotCommand, etcdsnapshotCommand, - etcdsnapshotCommand, ), cmds.NewSecretsEncryptCommands( secretsencryptCommand, diff --git a/cmd/server/main.go b/cmd/server/main.go index bf82d9c30583..37bf8d2cd326 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -56,7 +56,6 @@ func main() { token.List, ), cmds.NewEtcdSnapshotCommands( - etcdsnapshot.Run, etcdsnapshot.Delete, etcdsnapshot.List, etcdsnapshot.Prune, diff --git a/main.go b/main.go index e0e86b3ea2b7..ad09773f3ec2 100644 --- a/main.go +++ b/main.go @@ -33,7 +33,6 @@ func main() { cmds.NewKubectlCommand(kubectl.Run), cmds.NewCRICTL(crictl.Run), cmds.NewEtcdSnapshotCommands( - etcdsnapshot.Run, etcdsnapshot.Delete, etcdsnapshot.List, etcdsnapshot.Prune, diff --git a/pkg/agent/flannel/setup.go b/pkg/agent/flannel/setup.go index fe5263f463ed..299a52f0f6cf 100644 --- a/pkg/agent/flannel/setup.go +++ b/pkg/agent/flannel/setup.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "net" - "os/exec" "path/filepath" "strings" @@ -201,16 +200,7 @@ func createFlannelConf(nodeConfig *config.Node) error { backend := parts[0] backendOptions := make(map[string]string) 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") - 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] - } - } + logrus.Fatalf("The additional options through flannel-backend are deprecated and were removed in k3s v1.27, use flannel-conf instead") } switch backend { @@ -219,13 +209,7 @@ func createFlannelConf(nodeConfig *config.Node) error { case config.FlannelBackendHostGW: backendConf = hostGWBackend case config.FlannelBackendIPSEC: - backendConf = strings.ReplaceAll(ipsecBackend, "%psk%", nodeConfig.AgentConfig.IPSECPSK) - 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.") + 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.") case config.FlannelBackendWireguardNative: mode, ok := backendOptions["Mode"] if !ok { diff --git a/pkg/cli/cmds/etcd_snapshot.go b/pkg/cli/cmds/etcd_snapshot.go index 9f005e0ef747..28d6c831d452 100644 --- a/pkg/cli/cmds/etcd_snapshot.go +++ b/pkg/cli/cmds/etcd_snapshot.go @@ -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{ Name: EtcdSnapshotCommand, Usage: "Trigger an immediate etcd snapshot", SkipFlagParsing: false, SkipArgReorder: true, - Action: run, Subcommands: []cli.Command{ + { + Name: "save", + Usage: "Trigger an immediate etcd snapshot", + SkipFlagParsing: false, + SkipArgReorder: true, + Action: save, + Flags: EtcdSnapshotFlags, + }, { Name: "delete", Usage: "Delete given snapshot(s)", @@ -141,14 +148,6 @@ func NewEtcdSnapshotCommands(run, delete, list, prune, save func(ctx *cli.Contex Value: defaultSnapshotRentention, }), }, - { - Name: "save", - Usage: "Trigger an immediate etcd snapshot", - SkipFlagParsing: false, - SkipArgReorder: true, - Action: save, - Flags: EtcdSnapshotFlags, - }, }, Flags: EtcdSnapshotFlags, } diff --git a/pkg/cli/etcdsnapshot/etcd_snapshot.go b/pkg/cli/etcdsnapshot/etcd_snapshot.go index b61be1515b2e..6c3f51028419 100644 --- a/pkg/cli/etcdsnapshot/etcd_snapshot.go +++ b/pkg/cli/etcdsnapshot/etcd_snapshot.go @@ -69,12 +69,6 @@ func commandSetup(app *cli.Context, cfg *cmds.Server, sc *server.Config) error { 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 func Save(app *cli.Context) error { if err := cmds.InitLogging(); err != nil { diff --git a/pkg/daemons/config/types.go b/pkg/daemons/config/types.go index 43176b6e4116..33b1ab4ab274 100644 --- a/pkg/daemons/config/types.go +++ b/pkg/daemons/config/types.go @@ -24,7 +24,6 @@ const ( FlannelBackendVXLAN = "vxlan" FlannelBackendHostGW = "host-gw" FlannelBackendIPSEC = "ipsec" - FlannelBackendWireguard = "wireguard" FlannelBackendWireguardNative = "wireguard-native" EgressSelectorModeAgent = "agent" EgressSelectorModeCluster = "cluster"