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.Commands = []cli.Command{
cmds.NewEtcdSnapshotCommands(
etcdsnapshot.Run,
etcdsnapshot.Delete,
etcdsnapshot.List,
etcdsnapshot.Prune,

View File

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

View File

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

View File

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

View File

@ -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 {

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{
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,
}

View File

@ -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 {

View File

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