mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Merge pull request #97583 from knight42/feat/kubeadm-kubeconfig-user
feat(kubeadm): graduate command "kubeconfig user"
This commit is contained in:
commit
deb01c1a7a
@ -29,32 +29,29 @@ func NewCmdAlpha(in io.Reader, out io.Writer) *cobra.Command {
|
||||
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 " +
|
||||
"and will be removed in a future release"
|
||||
shCommand := newCmdSelfhosting(in)
|
||||
shCommand.Deprecated = shDeprecatedMessage
|
||||
for _, cmd := range shCommand.Commands() {
|
||||
cmd.Deprecated = shDeprecatedMessage
|
||||
}
|
||||
deprecateCommand(shDeprecatedMessage, shCommand)
|
||||
cmd.AddCommand(shCommand)
|
||||
|
||||
certsCommand := NewCmdCertsUtility(out)
|
||||
deprecateCertsCommand(certsCommand)
|
||||
deprecateCommand(`please use the same command under "kubeadm certs"`, certsCommand)
|
||||
cmd.AddCommand(certsCommand)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func deprecateCertsCommand(cmds ...*cobra.Command) {
|
||||
const deprecatedMessage = "please use the same command under \"kubeadm certs\""
|
||||
|
||||
func deprecateCommand(msg string, cmds ...*cobra.Command) {
|
||||
for _, cmd := range cmds {
|
||||
cmd.Deprecated = deprecatedMessage
|
||||
cmd.Deprecated = msg
|
||||
childCmds := cmd.Commands()
|
||||
if len(childCmds) > 0 {
|
||||
deprecateCertsCommand(childCmds...)
|
||||
deprecateCommand(msg, childCmds...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ var (
|
||||
`)
|
||||
)
|
||||
|
||||
// newCmdKubeConfigUtility returns main command for kubeconfig phase
|
||||
func newCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
||||
// NewCmdKubeConfigUtility returns main command for kubeconfig phase
|
||||
func NewCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "kubeconfig",
|
||||
Short: "Kubeconfig file utilities",
|
||||
|
@ -95,6 +95,9 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||
// TODO: remove "certs" from "alpha"
|
||||
// https://github.com/kubernetes/kubeadm/issues/2291
|
||||
cmds.AddCommand(alpha.NewCmdCertsUtility(out))
|
||||
// TODO: remove "kubeconfig" from "alpha"
|
||||
// https://github.com/kubernetes/kubeadm/issues/2292
|
||||
cmds.AddCommand(alpha.NewCmdKubeConfigUtility(out))
|
||||
|
||||
return cmds
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user