Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metallb addon: fix configuration empty load balancing IP range #10395

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/minikube/cmd/config/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pkg/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
50 changes: 25 additions & 25 deletions pkg/addons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var Addons = []*Addon{
{
name: "dashboard",
set: SetBool,
callbacks: []setFn{enableOrDisableAddon},
callbacks: []setFn{EnableOrDisableAddon},
},

{
Expand All @@ -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",
Expand All @@ -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},
},
}
2 changes: 1 addition & 1 deletion site/content/en/docs/contrib/addons.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
```

Expand Down