mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
refactor(kubeadm): remove deprecated command alpha kubeconfig
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
This commit is contained in:
parent
9aa6f0bc47
commit
41c4cccc26
@ -29,19 +29,5 @@ func NewCmdAlpha(in io.Reader, out io.Writer) *cobra.Command {
|
||||
Short: "Kubeadm experimental sub-commands",
|
||||
}
|
||||
|
||||
kubeconfigCmd := NewCmdKubeConfigUtility(out)
|
||||
deprecateCommand(`please use the same command under "kubeadm kubeconfig"`, kubeconfigCmd)
|
||||
cmd.AddCommand(kubeconfigCmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func deprecateCommand(msg string, cmds ...*cobra.Command) {
|
||||
for _, cmd := range cmds {
|
||||
cmd.Deprecated = msg
|
||||
childCmds := cmd.Commands()
|
||||
if len(childCmds) > 0 {
|
||||
deprecateCommand(msg, childCmds...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,9 +93,7 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||
cmds.AddCommand(upgrade.NewCmdUpgrade(out))
|
||||
cmds.AddCommand(alpha.NewCmdAlpha(in, out))
|
||||
options.AddKubeadmOtherFlags(cmds.PersistentFlags(), &rootfsPath)
|
||||
// TODO: remove "kubeconfig" from "alpha"
|
||||
// https://github.com/kubernetes/kubeadm/issues/2292
|
||||
cmds.AddCommand(alpha.NewCmdKubeConfigUtility(out))
|
||||
cmds.AddCommand(newCmdKubeConfigUtility(out))
|
||||
|
||||
return cmds
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package alpha
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"io"
|
||||
@ -34,20 +34,20 @@ import (
|
||||
var (
|
||||
kubeconfigLongDesc = cmdutil.LongDesc(`
|
||||
Kubeconfig file utilities.
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
`)
|
||||
|
||||
userKubeconfigLongDesc = cmdutil.LongDesc(`
|
||||
Output a kubeconfig file for an additional user.
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
`)
|
||||
|
||||
userKubeconfigExample = cmdutil.Examples(`
|
||||
# Output a kubeconfig file for an additional user named foo using a kubeadm config file bar
|
||||
kubeadm alpha kubeconfig user --client-name=foo --config=bar
|
||||
kubeadm kubeconfig user --client-name=foo --config=bar
|
||||
`)
|
||||
)
|
||||
|
||||
// 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",
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package alpha
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
Loading…
Reference in New Issue
Block a user