From 4ba0f52f577c23fe985905dea7240539fab3edcd Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Thu, 6 Feb 2020 17:29:19 -0800 Subject: [PATCH 1/2] Add flag to toggle installation of addons --- cmd/minikube/cmd/start.go | 12 ++++++++---- test/integration/start_stop_delete_test.go | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 5c7a21c59f5b..5e633d1b2f73 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -92,6 +92,7 @@ const ( kvmHidden = "kvm-hidden" minikubeEnvPrefix = "MINIKUBE" defaultMemorySize = "2000mb" + installAddons = "install-addons" defaultDiskSize = "20000mb" keepContext = "keep-context" createMount = "mount" @@ -179,6 +180,7 @@ func initMinikubeFlags() { startCmd.Flags().Duration(waitTimeout, 6*time.Minute, "max time to wait per Kubernetes core services to be healthy.") startCmd.Flags().Bool(nativeSSH, true, "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.") startCmd.Flags().Bool(autoUpdate, true, "If set, automatically updates drivers to the latest version. Defaults to true.") + startCmd.Flags().Bool(installAddons, true, "If set, install addons. Defaults to true.") } // initKubernetesFlags inits the commandline flags for kubernetes related options @@ -369,11 +371,13 @@ func runStart(cmd *cobra.Command, args []string) { configureMounts() // enable addons, both old and new! - existingAddons := map[string]bool{} - if existing != nil && existing.Addons != nil { - existingAddons = existing.Addons + if viper.GetBool(installAddons) { + existingAddons := map[string]bool{} + if existing != nil && existing.Addons != nil { + existingAddons = existing.Addons + } + addons.Start(viper.GetString(config.MachineProfile), existingAddons, addonList) } - addons.Start(viper.GetString(config.MachineProfile), existingAddons, addonList) if err = cacheAndLoadImagesInConfig(); err != nil { out.T(out.FailureType, "Unable to load cached images from config file.") diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index 6c9e2d6b4827..dc11a95f1861 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -53,6 +53,7 @@ func TestStartStop(t *testing.T) { "--disable-driver-mounts", "--keep-context=false", "--container-runtime=docker", + "--install-addons=false", }}, {"newest-cni", constants.NewestKubernetesVersion, []string{ "--feature-gates", From caf4c629437f227a41f7a42f46e97fe080a21329 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Thu, 6 Feb 2020 17:35:52 -0800 Subject: [PATCH 2/2] Move --install-addons toggle to tests that do not use addons --- test/integration/docker_test.go | 2 +- test/integration/guest_env_test.go | 2 +- test/integration/start_stop_delete_test.go | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/integration/docker_test.go b/test/integration/docker_test.go index c04ba8617d54..e8c73df9c83c 100644 --- a/test/integration/docker_test.go +++ b/test/integration/docker_test.go @@ -37,7 +37,7 @@ func TestDockerFlags(t *testing.T) { defer CleanupWithLogs(t, profile, cancel) // Use the most verbose logging for the simplest test. If it fails, something is very wrong. - args := append([]string{"start", "-p", profile, "--cache-images=false", "--wait=false", "--docker-env=FOO=BAR", "--docker-env=BAZ=BAT", "--docker-opt=debug", "--docker-opt=icc=true", "--alsologtostderr", "-v=5"}, StartArgs()...) + args := append([]string{"start", "-p", profile, "--cache-images=false", "--install-addons=false", "--wait=false", "--docker-env=FOO=BAR", "--docker-env=BAZ=BAT", "--docker-opt=debug", "--docker-opt=icc=true", "--alsologtostderr", "-v=5"}, StartArgs()...) rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) if err != nil { t.Errorf("%s failed: %v", rr.Args, err) diff --git a/test/integration/guest_env_test.go b/test/integration/guest_env_test.go index 3182daf67a0e..29bf60ab5fce 100644 --- a/test/integration/guest_env_test.go +++ b/test/integration/guest_env_test.go @@ -33,7 +33,7 @@ func TestGuestEnvironment(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) defer CleanupWithLogs(t, profile, cancel) - args := append([]string{"start", "-p", profile, "--wait=false"}, StartArgs()...) + args := append([]string{"start", "-p", profile, "--install-addons=false", "--wait=false"}, StartArgs()...) rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) if err != nil { t.Errorf("%s failed: %v", rr.Args, err) diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index dc11a95f1861..6c9e2d6b4827 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -53,7 +53,6 @@ func TestStartStop(t *testing.T) { "--disable-driver-mounts", "--keep-context=false", "--container-runtime=docker", - "--install-addons=false", }}, {"newest-cni", constants.NewestKubernetesVersion, []string{ "--feature-gates",