Merge pull request #94938 from yagonobre/certs-graduate

Graduate kubeadm alpha certs command
This commit is contained in:
Kubernetes Prow Robot 2020-09-23 08:36:10 -07:00 committed by GitHub
commit 7a2812ca60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}