diff --git a/cmd/minikube/cmd/config/configure.go b/cmd/minikube/cmd/config/configure.go index b5800cf2fb84..11bb24830a2c 100644 --- a/cmd/minikube/cmd/config/configure.go +++ b/cmd/minikube/cmd/config/configure.go @@ -22,6 +22,7 @@ import ( "regexp" "github.com/spf13/cobra" + "k8s.io/minikube/pkg/addons" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/mustload" @@ -208,6 +209,11 @@ var addonsConfigureCmd = &cobra.Command{ if err := config.SaveProfile(profile, cfg); err != nil { out.ErrT(style.Fatal, "Failed to save config {{.profile}}", out.V{"profile": profile}) } + + // Re-enable metallb addon in order to generate template manifest files with Load Balancer Start/End IP + if err := addons.EnableOrDisableAddon(cfg, "metallb", "true"); err != nil { + out.ErrT(style.Fatal, "Failed to configure metallb IP {{.profile}}", out.V{"profile": profile}) + } case "ingress": profile := ClusterFlagValue() _, cfg := mustload.Partial(profile) diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index c8918faa77e0..ac8f6548b469 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -126,8 +126,8 @@ func SetBool(cc *config.ClusterConfig, name string, val string) error { return nil } -// enableOrDisableAddon updates addon status executing any commands necessary -func enableOrDisableAddon(cc *config.ClusterConfig, name string, val string) error { +// EnableOrDisableAddon updates addon status executing any commands necessary +func EnableOrDisableAddon(cc *config.ClusterConfig, name string, val string) error { klog.Infof("Setting addon %s=%s in %q", name, val, cc.Name) enable, err := strconv.ParseBool(val) if err != nil { @@ -298,7 +298,7 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st } if !machine.IsRunning(api, config.MachineName(*cc, cp)) { klog.Warningf("%q is not running, writing %s=%v to disk and skipping enablement", config.MachineName(*cc, cp), name, val) - return enableOrDisableAddon(cc, name, val) + return EnableOrDisableAddon(cc, name, val) } storagev1, err := storageclass.GetStoragev1(cc.Name) @@ -320,7 +320,7 @@ func enableOrDisableStorageClasses(cc *config.ClusterConfig, name string, val st } } - return enableOrDisableAddon(cc, name, val) + return EnableOrDisableAddon(cc, name, val) } func verifyAddonStatus(cc *config.ClusterConfig, name string, val string) error { diff --git a/pkg/addons/config.go b/pkg/addons/config.go index 980915f407e6..79f77e7df480 100644 --- a/pkg/addons/config.go +++ b/pkg/addons/config.go @@ -45,7 +45,7 @@ var Addons = []*Addon{ { name: "dashboard", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { @@ -56,95 +56,95 @@ var Addons = []*Addon{ { name: "efk", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "freshpod", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "gvisor", set: SetBool, validations: []setFn{IsRuntimeContainerd}, - callbacks: []setFn{enableOrDisableAddon, verifyAddonStatus}, + callbacks: []setFn{EnableOrDisableAddon, verifyAddonStatus}, }, { name: "helm-tiller", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "ingress", set: SetBool, - callbacks: []setFn{enableOrDisableAddon, verifyAddonStatus}, + callbacks: []setFn{EnableOrDisableAddon, verifyAddonStatus}, }, { name: "ingress-dns", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "istio-provisioner", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "istio", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "kubevirt", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "logviewer", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "metrics-server", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "nvidia-driver-installer", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "nvidia-gpu-device-plugin", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "olm", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "registry", set: SetBool, - callbacks: []setFn{enableOrDisableAddon, verifyAddonStatus}, + callbacks: []setFn{EnableOrDisableAddon, verifyAddonStatus}, }, { name: "registry-creds", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "registry-aliases", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, //TODO - add other settings //TODO check if registry addon is enabled }, { name: "storage-provisioner", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "storage-provisioner-gluster", @@ -154,32 +154,32 @@ var Addons = []*Addon{ { name: "metallb", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "ambassador", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "pod-security-policy", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "gcp-auth", set: SetBool, - callbacks: []setFn{gcpauth.EnableOrDisable, enableOrDisableAddon, verifyGCPAuthAddon}, + callbacks: []setFn{gcpauth.EnableOrDisable, EnableOrDisableAddon, verifyGCPAuthAddon}, }, { name: "volumesnapshots", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, { name: "csi-hostpath-driver", set: SetBool, validations: []setFn{IsVolumesnapshotsEnabled}, - callbacks: []setFn{enableOrDisableAddon, verifyAddonStatus}, + callbacks: []setFn{EnableOrDisableAddon, verifyAddonStatus}, }, } diff --git a/site/content/en/docs/contrib/addons.en.md b/site/content/en/docs/contrib/addons.en.md index 1305f88a59ef..0ffe72693445 100644 --- a/site/content/en/docs/contrib/addons.en.md +++ b/site/content/en/docs/contrib/addons.en.md @@ -43,7 +43,7 @@ To make the addon appear in `minikube addons list`, add it to `pkg/addons/config { name: "registry", set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, + callbacks: []setFn{EnableOrDisableAddon}, }, ```