mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +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",
|
Short: "Kubeadm experimental sub-commands",
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeconfigCmd := NewCmdKubeConfigUtility(out)
|
|
||||||
deprecateCommand(`please use the same command under "kubeadm kubeconfig"`, kubeconfigCmd)
|
|
||||||
cmd.AddCommand(kubeconfigCmd)
|
|
||||||
|
|
||||||
return cmd
|
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(upgrade.NewCmdUpgrade(out))
|
||||||
cmds.AddCommand(alpha.NewCmdAlpha(in, out))
|
cmds.AddCommand(alpha.NewCmdAlpha(in, out))
|
||||||
options.AddKubeadmOtherFlags(cmds.PersistentFlags(), &rootfsPath)
|
options.AddKubeadmOtherFlags(cmds.PersistentFlags(), &rootfsPath)
|
||||||
// TODO: remove "kubeconfig" from "alpha"
|
cmds.AddCommand(newCmdKubeConfigUtility(out))
|
||||||
// https://github.com/kubernetes/kubeadm/issues/2292
|
|
||||||
cmds.AddCommand(alpha.NewCmdKubeConfigUtility(out))
|
|
||||||
|
|
||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package alpha
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
@ -34,20 +34,20 @@ import (
|
|||||||
var (
|
var (
|
||||||
kubeconfigLongDesc = cmdutil.LongDesc(`
|
kubeconfigLongDesc = cmdutil.LongDesc(`
|
||||||
Kubeconfig file utilities.
|
Kubeconfig file utilities.
|
||||||
` + cmdutil.AlphaDisclaimer)
|
`)
|
||||||
|
|
||||||
userKubeconfigLongDesc = cmdutil.LongDesc(`
|
userKubeconfigLongDesc = cmdutil.LongDesc(`
|
||||||
Output a kubeconfig file for an additional user.
|
Output a kubeconfig file for an additional user.
|
||||||
` + cmdutil.AlphaDisclaimer)
|
`)
|
||||||
|
|
||||||
userKubeconfigExample = cmdutil.Examples(`
|
userKubeconfigExample = cmdutil.Examples(`
|
||||||
# Output a kubeconfig file for an additional user named foo using a kubeadm config file bar
|
# 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
|
// newCmdKubeConfigUtility returns main command for kubeconfig phase
|
||||||
func NewCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
func newCmdKubeConfigUtility(out io.Writer) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "kubeconfig",
|
Use: "kubeconfig",
|
||||||
Short: "Kubeconfig file utilities",
|
Short: "Kubeconfig file utilities",
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package alpha
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
Loading…
Reference in New Issue
Block a user