Graduate kubeadm alpha certs command

This commit is contained in:
Yago Nobre 2020-09-19 08:59:02 -03:00
parent 2d8fbd61af
commit 2f19cf7cbc
3 changed files with 22 additions and 4 deletions

View File

@ -29,9 +29,24 @@ func NewCmdAlpha(in io.Reader, out io.Writer) *cobra.Command {
Short: "Kubeadm experimental sub-commands",
}
cmd.AddCommand(newCmdCertsUtility(out))
cmd.AddCommand(newCmdKubeConfigUtility(out))
cmd.AddCommand(NewCmdSelfhosting(in))
certsCommand := NewCmdCertsUtility(out)
deprecateCertsCommand(certsCommand)
cmd.AddCommand(certsCommand)
return cmd
}
func deprecateCertsCommand(cmds ...*cobra.Command) {
const deprecatedMessage = "please use the same command under \"kubeadm certs\""
for _, cmd := range cmds {
cmd.Deprecated = deprecatedMessage
childCmds := cmd.Commands()
if len(childCmds) > 0 {
deprecateCertsCommand(childCmds...)
}
}
}

View File

@ -90,8 +90,8 @@ var (
`)
)
// newCmdCertsUtility returns main command for certs phase
func newCmdCertsUtility(out io.Writer) *cobra.Command {
// NewCmdCertsUtility returns main command for certs phase
func NewCmdCertsUtility(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "certs",
Aliases: []string{"certificates"},

View File

@ -90,8 +90,11 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
cmds.AddCommand(NewCmdToken(out, err))
cmds.AddCommand(upgrade.NewCmdUpgrade(out))
cmds.AddCommand(alpha.NewCmdAlpha(in, out))
options.AddKubeadmOtherFlags(cmds.PersistentFlags(), &rootfsPath)
// TODO: remove "certs" from "alpha"
// https://github.com/kubernetes/kubeadm/issues/2291
cmds.AddCommand(alpha.NewCmdCertsUtility(out))
return cmds
}