mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
feat(kubeadm): graduate command "kubeconfig user"
This commit is contained in:
parent
80be1d6c72
commit
5ae687ecc6
@ -29,32 +29,29 @@ func NewCmdAlpha(in io.Reader, out io.Writer) *cobra.Command {
|
|||||||
Short: "Kubeadm experimental sub-commands",
|
Short: "Kubeadm experimental sub-commands",
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(newCmdKubeConfigUtility(out))
|
kubeconfigCmd := NewCmdKubeConfigUtility(out)
|
||||||
|
deprecateCommand(`please use the same command under "kubeadm kubeconfig"`, kubeconfigCmd)
|
||||||
|
cmd.AddCommand(kubeconfigCmd)
|
||||||
|
|
||||||
const shDeprecatedMessage = "self-hosting support in kubeadm is deprecated " +
|
const shDeprecatedMessage = "self-hosting support in kubeadm is deprecated " +
|
||||||
"and will be removed in a future release"
|
"and will be removed in a future release"
|
||||||
shCommand := newCmdSelfhosting(in)
|
shCommand := newCmdSelfhosting(in)
|
||||||
shCommand.Deprecated = shDeprecatedMessage
|
deprecateCommand(shDeprecatedMessage, shCommand)
|
||||||
for _, cmd := range shCommand.Commands() {
|
|
||||||
cmd.Deprecated = shDeprecatedMessage
|
|
||||||
}
|
|
||||||
cmd.AddCommand(shCommand)
|
cmd.AddCommand(shCommand)
|
||||||
|
|
||||||
certsCommand := NewCmdCertsUtility(out)
|
certsCommand := NewCmdCertsUtility(out)
|
||||||
deprecateCertsCommand(certsCommand)
|
deprecateCommand(`please use the same command under "kubeadm certs"`, certsCommand)
|
||||||
cmd.AddCommand(certsCommand)
|
cmd.AddCommand(certsCommand)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func deprecateCertsCommand(cmds ...*cobra.Command) {
|
func deprecateCommand(msg string, cmds ...*cobra.Command) {
|
||||||
const deprecatedMessage = "please use the same command under \"kubeadm certs\""
|
|
||||||
|
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
cmd.Deprecated = deprecatedMessage
|
cmd.Deprecated = msg
|
||||||
childCmds := cmd.Commands()
|
childCmds := cmd.Commands()
|
||||||
if len(childCmds) > 0 {
|
if len(childCmds) > 0 {
|
||||||
deprecateCertsCommand(childCmds...)
|
deprecateCommand(msg, childCmds...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ var (
|
|||||||
`)
|
`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// newCmdKubeConfigUtility returns main command for kubeconfig phase
|
// NewCmdKubeConfigUtility returns main command for kubeconfig phase
|
||||||
func newCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
func NewCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "kubeconfig",
|
Use: "kubeconfig",
|
||||||
Short: "Kubeconfig file utilities",
|
Short: "Kubeconfig file utilities",
|
||||||
|
@ -95,6 +95,9 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
|||||||
// TODO: remove "certs" from "alpha"
|
// TODO: remove "certs" from "alpha"
|
||||||
// https://github.com/kubernetes/kubeadm/issues/2291
|
// https://github.com/kubernetes/kubeadm/issues/2291
|
||||||
cmds.AddCommand(alpha.NewCmdCertsUtility(out))
|
cmds.AddCommand(alpha.NewCmdCertsUtility(out))
|
||||||
|
// TODO: remove "kubeconfig" from "alpha"
|
||||||
|
// https://github.com/kubernetes/kubeadm/issues/2292
|
||||||
|
cmds.AddCommand(alpha.NewCmdKubeConfigUtility(out))
|
||||||
|
|
||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user