Merge pull request #4366 from thaJeztah/remove_deprecated_context_stubs

cli/command/context: remove deprecated k8s / orchestrator option-stubs
This commit is contained in:
Sebastiaan van Stijn 2023-06-28 14:42:18 +02:00 committed by GitHub
commit 27bae1172a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 31 deletions

View File

@ -51,18 +51,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
} }
flags := cmd.Flags() flags := cmd.Flags()
flags.StringVar(&opts.Description, "description", "", "Description of the context") 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.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") flags.StringVar(&opts.From, "from", "", "create context from a named context")
return cmd return cmd
} }

View File

@ -19,13 +19,14 @@ type ExportOptions struct {
} }
func newExportCommand(dockerCli command.Cli) *cobra.Command { func newExportCommand(dockerCli command.Cli) *cobra.Command {
opts := &ExportOptions{} return &cobra.Command{
cmd := &cobra.Command{
Use: "export [OPTIONS] CONTEXT [FILE|-]", Use: "export [OPTIONS] CONTEXT [FILE|-]",
Short: "Export a context to a tar archive FILE or a tar stream on STDOUT.", Short: "Export a context to a tar archive FILE or a tar stream on STDOUT.",
Args: cli.RequiresRangeArgs(1, 2), Args: cli.RequiresRangeArgs(1, 2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
opts.ContextName = args[0] opts := &ExportOptions{
ContextName: args[0],
}
if len(args) == 2 { if len(args) == 2 {
opts.Dest = args[1] opts.Dest = args[1]
} else { } else {
@ -34,13 +35,6 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command {
return RunExport(dockerCli, opts) 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 { func writeTo(dockerCli command.Cli, reader io.Reader, dest string) error {

View File

@ -47,17 +47,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
} }
flags := cmd.Flags() flags := cmd.Flags()
flags.StringVar(&opts.Description, "description", "", "Description of the context") 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.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 return cmd
} }