Skip to content

Commit 2f19cf7

Browse files
committed
Graduate kubeadm alpha certs command
1 parent 2d8fbd6 commit 2f19cf7

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

cmd/kubeadm/app/cmd/alpha/alpha.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,24 @@ func NewCmdAlpha(in io.Reader, out io.Writer) *cobra.Command {
2929
Short: "Kubeadm experimental sub-commands",
3030
}
3131

32-
cmd.AddCommand(newCmdCertsUtility(out))
3332
cmd.AddCommand(newCmdKubeConfigUtility(out))
3433
cmd.AddCommand(NewCmdSelfhosting(in))
3534

35+
certsCommand := NewCmdCertsUtility(out)
36+
deprecateCertsCommand(certsCommand)
37+
cmd.AddCommand(certsCommand)
38+
3639
return cmd
3740
}
41+
42+
func deprecateCertsCommand(cmds ...*cobra.Command) {
43+
const deprecatedMessage = "please use the same command under \"kubeadm certs\""
44+
45+
for _, cmd := range cmds {
46+
cmd.Deprecated = deprecatedMessage
47+
childCmds := cmd.Commands()
48+
if len(childCmds) > 0 {
49+
deprecateCertsCommand(childCmds...)
50+
}
51+
}
52+
}

cmd/kubeadm/app/cmd/alpha/certs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ var (
9090
`)
9191
)
9292

93-
// newCmdCertsUtility returns main command for certs phase
94-
func newCmdCertsUtility(out io.Writer) *cobra.Command {
93+
// NewCmdCertsUtility returns main command for certs phase
94+
func NewCmdCertsUtility(out io.Writer) *cobra.Command {
9595
cmd := &cobra.Command{
9696
Use: "certs",
9797
Aliases: []string{"certificates"},

cmd/kubeadm/app/cmd/cmd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
9090
cmds.AddCommand(NewCmdToken(out, err))
9191
cmds.AddCommand(upgrade.NewCmdUpgrade(out))
9292
cmds.AddCommand(alpha.NewCmdAlpha(in, out))
93-
9493
options.AddKubeadmOtherFlags(cmds.PersistentFlags(), &rootfsPath)
9594

95+
// TODO: remove "certs" from "alpha"
96+
// https://github.com/kubernetes/kubeadm/issues/2291
97+
cmds.AddCommand(alpha.NewCmdCertsUtility(out))
98+
9699
return cmds
97100
}

0 commit comments

Comments
 (0)