Merge pull request #8337 from taciomcosta/master
exit when minikube addons configure is called on a nonexistent clusterpull/8373/head
commit
c93576b5a2
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/exit"
|
||||
"k8s.io/minikube/pkg/minikube/mustload"
|
||||
"k8s.io/minikube/pkg/minikube/out"
|
||||
"k8s.io/minikube/pkg/minikube/service"
|
||||
)
|
||||
|
@ -188,10 +189,7 @@ var addonsConfigureCmd = &cobra.Command{
|
|||
|
||||
case "metallb":
|
||||
profile := ClusterFlagValue()
|
||||
cfg, err := config.Load(profile)
|
||||
if err != nil {
|
||||
out.ErrT(out.FatalType, "Failed to load config {{.profile}}", out.V{"profile": profile})
|
||||
}
|
||||
_, cfg := mustload.Partial(profile)
|
||||
|
||||
validator := func(s string) bool {
|
||||
return net.ParseIP(s) != nil
|
||||
|
@ -205,8 +203,7 @@ var addonsConfigureCmd = &cobra.Command{
|
|||
cfg.KubernetesConfig.LoadBalancerEndIP = AskForStaticValidatedValue("-- Enter Load Balancer End IP: ", validator)
|
||||
}
|
||||
|
||||
err = config.SaveProfile(profile, cfg)
|
||||
if err != nil {
|
||||
if err := config.SaveProfile(profile, cfg); err != nil {
|
||||
out.ErrT(out.FatalType, "Failed to save config {{.profile}}", out.V{"profile": profile})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue