mirror of https://github.com/docker/cli.git
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:
parent
aa75635eea
commit
cff010c61f
|
@ -14,7 +14,6 @@ import (
|
||||||
|
|
||||||
// ExportOptions are the options used for exporting a context
|
// ExportOptions are the options used for exporting a context
|
||||||
type ExportOptions struct {
|
type ExportOptions struct {
|
||||||
Kubeconfig bool
|
|
||||||
ContextName string
|
ContextName string
|
||||||
Dest string
|
Dest string
|
||||||
}
|
}
|
||||||
|
@ -23,26 +22,22 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
opts := &ExportOptions{}
|
opts := &ExportOptions{}
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "export [OPTIONS] CONTEXT [FILE|-]",
|
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),
|
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.ContextName = args[0]
|
||||||
if len(args) == 2 {
|
if len(args) == 2 {
|
||||||
opts.Dest = args[1]
|
opts.Dest = args[1]
|
||||||
} else {
|
} else {
|
||||||
opts.Dest = opts.ContextName
|
opts.Dest = opts.ContextName + ".dockercontext"
|
||||||
if opts.Kubeconfig {
|
|
||||||
opts.Dest += ".kubeconfig"
|
|
||||||
} else {
|
|
||||||
opts.Dest += ".dockercontext"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return RunExport(dockerCli, opts)
|
return RunExport(dockerCli, opts)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
flags := cmd.Flags()
|
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", "kubernetes", nil)
|
||||||
flags.SetAnnotation("kubeconfig", "deprecated", nil)
|
flags.SetAnnotation("kubeconfig", "deprecated", nil)
|
||||||
return cmd
|
return cmd
|
||||||
|
|
Loading…
Reference in New Issue