From d76b58c3aea76d88b6a44021f236cd7d75887cf3 Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Thu, 11 Jun 2020 21:55:29 +0900 Subject: [PATCH 1/6] Add heapster alias to metrics-server addon --- cmd/minikube/cmd/config/enable.go | 5 +++++ pkg/addons/config.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cmd/minikube/cmd/config/enable.go b/cmd/minikube/cmd/config/enable.go index f05daadfd614..e3d28969ba80 100644 --- a/cmd/minikube/cmd/config/enable.go +++ b/cmd/minikube/cmd/config/enable.go @@ -32,6 +32,11 @@ var addonsEnableCmd = &cobra.Command{ exit.UsageT("usage: minikube addons enable ADDON_NAME") } addon := args[0] + // replace heapster as metrics-server because heapster is deprecated + if addon == "heapster" { + out.T(out.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated") + addon = "metrics-server" + } err := addons.SetAndSave(ClusterFlagValue(), addon, "true") if err != nil { exit.WithError("enable failed", err) diff --git a/pkg/addons/config.go b/pkg/addons/config.go index 80fb4ad6f5f3..3283754a60df 100644 --- a/pkg/addons/config.go +++ b/pkg/addons/config.go @@ -149,4 +149,9 @@ var Addons = []*Addon{ set: SetBool, callbacks: []setFn{enableOrDisableAddon}, }, + { + name: "heapster", + set: SetBool, + callbacks: []setFn{enableOrDisableAddon}, + }, } From d7a9721712d23ed850b384175762da94aa7726cb Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Thu, 11 Jun 2020 22:14:44 +0900 Subject: [PATCH 2/6] Avoid SIGSEGV when heapster addon will be disabled --- cmd/minikube/cmd/config/disable.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/minikube/cmd/config/disable.go b/cmd/minikube/cmd/config/disable.go index a77f44092d12..08c5215dbd69 100644 --- a/cmd/minikube/cmd/config/disable.go +++ b/cmd/minikube/cmd/config/disable.go @@ -33,6 +33,9 @@ var addonsDisableCmd = &cobra.Command{ } addon := args[0] + if addon == "heapster" { + exit.WithCodeT(exit.Unavailable, "There is no heapster addon") + } err := addons.SetAndSave(ClusterFlagValue(), addon, "false") if err != nil { exit.WithError("disable failed", err) From 9d71fc635b1c899a3f38817b3d8fa96eb68890af Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Thu, 11 Jun 2020 23:16:28 +0900 Subject: [PATCH 3/6] remove unneccesary config --- pkg/addons/config.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/addons/config.go b/pkg/addons/config.go index 3283754a60df..80fb4ad6f5f3 100644 --- a/pkg/addons/config.go +++ b/pkg/addons/config.go @@ -149,9 +149,4 @@ var Addons = []*Addon{ set: SetBool, callbacks: []setFn{enableOrDisableAddon}, }, - { - name: "heapster", - set: SetBool, - callbacks: []setFn{enableOrDisableAddon}, - }, } From 803461ddcf07eb17b604c965af182a022e436d2d Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Thu, 11 Jun 2020 23:17:17 +0900 Subject: [PATCH 4/6] if the specified addon doesn't exist, skip enabling --- pkg/addons/addons.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 56899c5a9d27..c338b844d141 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -334,7 +334,11 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo // Apply new addons for _, name := range additional { - toEnable[name] = true + // if the specified addon doesn't exist, skip enabling + _, e := isAddonValid(name) + if e { + toEnable[name] = true + } } toEnableList := []string{} From 24b2a6998156cd509c90ba5fa41c0e6aee6117e0 Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Sat, 13 Jun 2020 01:06:57 +0900 Subject: [PATCH 5/6] fix disable heapster message --- cmd/minikube/cmd/config/disable.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/config/disable.go b/cmd/minikube/cmd/config/disable.go index 08c5215dbd69..76d6204c0d3b 100644 --- a/cmd/minikube/cmd/config/disable.go +++ b/cmd/minikube/cmd/config/disable.go @@ -34,7 +34,7 @@ var addonsDisableCmd = &cobra.Command{ addon := args[0] if addon == "heapster" { - exit.WithCodeT(exit.Unavailable, "There is no heapster addon") + exit.WithCodeT(exit.Unavailable, "The heapster addon is depreciated. please try to disable metrics-server instead") } err := addons.SetAndSave(ClusterFlagValue(), addon, "false") if err != nil { From ab58dca23d013a4337024438b53bbf3e591ee275 Mon Sep 17 00:00:00 2001 From: Kenta Iso Date: Sat, 13 Jun 2020 01:07:16 +0900 Subject: [PATCH 6/6] replace to metrics-server in case of `minikube start --addons heapster` --- pkg/addons/addons.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index c338b844d141..e7d58cc5c98d 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -334,6 +334,10 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo // Apply new addons for _, name := range additional { + // replace heapster as metrics-server because heapster is deprecated + if name == "heapster" { + name = "metrics-server" + } // if the specified addon doesn't exist, skip enabling _, e := isAddonValid(name) if e {