From 2133d0446a795a5b3a5da8b02261aa2f7039755a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 21 Jun 2023 11:27:41 +0200 Subject: [PATCH] cli/command/context: remove deprecated k8s / orchestrator option-stubs support for kubernetes contexts was deprecated in docker 20.10 through b639ea8b89b162c3abe99d3ac90b258c48e2039c, 0793f9639440d8980226485189ce0eb43e0af28b, and 1d37fb302789c6ce4ba120bc4ad577c92674467f, and removed altoghether in 23.0 through 193ede9b12b53e8aa595356e8b823f883e49bdc5. This patch removes the remaining stubs for options that were deprecated and no longer used. Signed-off-by: Sebastiaan van Stijn --- cli/command/context/create.go | 11 ----------- cli/command/context/export.go | 14 ++++---------- cli/command/context/update.go | 10 ---------- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/cli/command/context/create.go b/cli/command/context/create.go index 6334ce6c34..2ff2ca8ef6 100644 --- a/cli/command/context/create.go +++ b/cli/command/context/create.go @@ -51,18 +51,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() flags.StringVar(&opts.Description, "description", "", "Description of the context") - flags.String( - "default-stack-orchestrator", "", - `Default orchestrator for stack operations to use with this context ("swarm", "kubernetes", "all")`, - ) - flags.SetAnnotation("default-stack-orchestrator", "deprecated", nil) - flags.SetAnnotation("default-stack-orchestrator", "deprecated", nil) - flags.MarkDeprecated("default-stack-orchestrator", "option will be ignored") flags.StringToStringVar(&opts.Docker, "docker", nil, "set the docker endpoint") - flags.StringToString("kubernetes", nil, "set the kubernetes endpoint") - flags.SetAnnotation("kubernetes", "kubernetes", nil) - flags.SetAnnotation("kubernetes", "deprecated", nil) - flags.MarkDeprecated("kubernetes", "option will be ignored") flags.StringVar(&opts.From, "from", "", "create context from a named context") return cmd } diff --git a/cli/command/context/export.go b/cli/command/context/export.go index a8f9220c3e..8bccbf0d54 100644 --- a/cli/command/context/export.go +++ b/cli/command/context/export.go @@ -19,13 +19,14 @@ type ExportOptions struct { } func newExportCommand(dockerCli command.Cli) *cobra.Command { - opts := &ExportOptions{} - cmd := &cobra.Command{ + return &cobra.Command{ Use: "export [OPTIONS] CONTEXT [FILE|-]", Short: "Export a context to a tar archive FILE or a tar stream on STDOUT.", Args: cli.RequiresRangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { - opts.ContextName = args[0] + opts := &ExportOptions{ + ContextName: args[0], + } if len(args) == 2 { opts.Dest = args[1] } else { @@ -34,13 +35,6 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command { return RunExport(dockerCli, opts) }, } - - flags := cmd.Flags() - flags.Bool("kubeconfig", false, "Export as a kubeconfig file") - flags.MarkDeprecated("kubeconfig", "option will be ignored") - flags.SetAnnotation("kubeconfig", "kubernetes", nil) - flags.SetAnnotation("kubeconfig", "deprecated", nil) - return cmd } func writeTo(dockerCli command.Cli, reader io.Reader, dest string) error { diff --git a/cli/command/context/update.go b/cli/command/context/update.go index 5a776cb1db..e039736dac 100644 --- a/cli/command/context/update.go +++ b/cli/command/context/update.go @@ -47,17 +47,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() flags.StringVar(&opts.Description, "description", "", "Description of the context") - flags.String( - "default-stack-orchestrator", "", - "Default orchestrator for stack operations to use with this context (swarm|kubernetes|all)", - ) - flags.SetAnnotation("default-stack-orchestrator", "deprecated", nil) - flags.MarkDeprecated("default-stack-orchestrator", "option will be ignored") flags.StringToStringVar(&opts.Docker, "docker", nil, "set the docker endpoint") - flags.StringToString("kubernetes", nil, "set the kubernetes endpoint") - flags.SetAnnotation("kubernetes", "kubernetes", nil) - flags.SetAnnotation("kubernetes", "deprecated", nil) - flags.MarkDeprecated("kubernetes", "option will be ignored") return cmd }