From cff010c61fb33907e196ac0b54326cdd40b33b0c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 23 Feb 2022 18:01:24 +0100 Subject: [PATCH] context export: remove docker context export --kubeconfig options Removes the --kubeconfig flag, and the corresponding ExportOptions.Kubeconfig, as well as special handling for kubeconfig export, as it's no longer used. Signed-off-by: Sebastiaan van Stijn --- cli/command/context/export.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cli/command/context/export.go b/cli/command/context/export.go index 7e27fa56be..d06e84d94a 100644 --- a/cli/command/context/export.go +++ b/cli/command/context/export.go @@ -14,7 +14,6 @@ import ( // ExportOptions are the options used for exporting a context type ExportOptions struct { - Kubeconfig bool ContextName string Dest string } @@ -23,26 +22,22 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command { opts := &ExportOptions{} cmd := &cobra.Command{ Use: "export [OPTIONS] CONTEXT [FILE|-]", - Short: "Export a context to a tar or kubeconfig 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] if len(args) == 2 { opts.Dest = args[1] } else { - opts.Dest = opts.ContextName - if opts.Kubeconfig { - opts.Dest += ".kubeconfig" - } else { - opts.Dest += ".dockercontext" - } + opts.Dest = opts.ContextName + ".dockercontext" } return RunExport(dockerCli, opts) }, } flags := cmd.Flags() - flags.BoolVar(&opts.Kubeconfig, "kubeconfig", false, "Export as a kubeconfig file") + 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