kubeadm: update the help msg for kubeadm upgrade plan

Explictly show the help msg that `kubeadm upgrade plan` can only run
on the node where "admin.conf" exists, normally, this is the control
plane node.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2023-12-07 15:35:23 +08:00
parent e4b74dd12f
commit 39417e9d44

View File

@ -36,6 +36,7 @@ import (
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme" outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
outputapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2" outputapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs" "k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs"
"k8s.io/kubernetes/cmd/kubeadm/app/constants" "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade" "k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
@ -46,6 +47,12 @@ type planFlags struct {
*applyPlanFlags *applyPlanFlags
} }
var upgradePlanLongDesc = cmdutil.LongDesc(`
Check which versions are available to upgrade to and validate whether your current cluster is upgradeable.
This command can only run on the control plane nodes where the kubeconfig file "admin.conf" exists.
To skip the internet check, pass in the optional [version] parameter.
`)
// newCmdPlan returns the cobra command for `kubeadm upgrade plan` // newCmdPlan returns the cobra command for `kubeadm upgrade plan`
func newCmdPlan(apf *applyPlanFlags) *cobra.Command { func newCmdPlan(apf *applyPlanFlags) *cobra.Command {
flags := &planFlags{ flags := &planFlags{
@ -56,7 +63,8 @@ func newCmdPlan(apf *applyPlanFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "plan [version] [flags]", Use: "plan [version] [flags]",
Short: "Check which versions are available to upgrade to and validate whether your current cluster is upgradeable. To skip the internet check, pass in the optional [version] parameter", Short: "Check which versions are available to upgrade to and validate whether your current cluster is upgradeable.",
Long: upgradePlanLongDesc,
RunE: func(_ *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
printer, err := outputFlags.ToPrinter() printer, err := outputFlags.ToPrinter()
if err != nil { if err != nil {