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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-02-23 18:01:24 +01:00
parent aa75635eea
commit cff010c61f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 4 additions and 9 deletions

View File

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