Merge pull request #97583 from knight42/feat/kubeadm-kubeconfig-user

feat(kubeadm): graduate command "kubeconfig user"
This commit is contained in:
Kubernetes Prow Robot 2020-12-30 15:09:49 -08:00 committed by GitHub
commit deb01c1a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -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...)
}
}
}

View File

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

View File

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