mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #105649 from navist2020/kubeadm/kubeconfig/cfgPath
kubeadm/kubeconfig:validate flag --config to make sure it is not empty
This commit is contained in:
commit
3f85ed46db
@ -20,6 +20,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
@ -78,6 +79,9 @@ func newCmdUserKubeConfig(out io.Writer) *cobra.Command {
|
|||||||
Long: userKubeconfigLongDesc,
|
Long: userKubeconfigLongDesc,
|
||||||
Example: userKubeconfigExample,
|
Example: userKubeconfigExample,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if len(cfgPath) == 0 {
|
||||||
|
return errors.New("the kubeadm configuration path cannot be empty")
|
||||||
|
}
|
||||||
// This call returns the ready-to-use configuration based on the defaults populated by flags
|
// This call returns the ready-to-use configuration based on the defaults populated by flags
|
||||||
internalCfg, err := configutil.LoadOrDefaultInitConfiguration(cfgPath, initCfg, clusterCfg)
|
internalCfg, err := configutil.LoadOrDefaultInitConfiguration(cfgPath, initCfg, clusterCfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user