From 0e665930e86e118976b5c6b3912aaed51ccfe20f Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Wed, 14 Jul 2021 15:00:22 +0530 Subject: [PATCH] Add message to discourage the use of virtualbox driver --- cmd/minikube/cmd/config/config.go | 4 ++++ cmd/minikube/cmd/root.go | 1 + pkg/minikube/config/config.go | 2 ++ pkg/minikube/node/start.go | 17 +++++++++++++++++ site/content/en/docs/commands/config.md | 1 + 5 files changed, 25 insertions(+) diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index 509d202eba..738ac8badc 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -126,6 +126,10 @@ var settings = []Setting{ name: config.WantNoneDriverWarning, set: SetBool, }, + { + name: config.WantVirtualBoxDriverWarning, + set: SetBool, + }, { name: config.ProfileName, set: SetString, diff --git a/cmd/minikube/cmd/root.go b/cmd/minikube/cmd/root.go index 9049596c09..785a2db36b 100644 --- a/cmd/minikube/cmd/root.go +++ b/cmd/minikube/cmd/root.go @@ -305,6 +305,7 @@ func setupViper() { viper.SetDefault(config.WantUpdateNotification, true) viper.SetDefault(config.ReminderWaitPeriodInHours, 24) viper.SetDefault(config.WantNoneDriverWarning, true) + viper.SetDefault(config.WantVirtualBoxDriverWarning, true) } func addToPath(dir string) { diff --git a/pkg/minikube/config/config.go b/pkg/minikube/config/config.go index 893844eaee..a1129fcb72 100644 --- a/pkg/minikube/config/config.go +++ b/pkg/minikube/config/config.go @@ -38,6 +38,8 @@ const ( ReminderWaitPeriodInHours = "ReminderWaitPeriodInHours" // WantNoneDriverWarning is the key for WantNoneDriverWarning WantNoneDriverWarning = "WantNoneDriverWarning" + // WantVirtualBoxDriverWarning is the key for WantVirtualBoxDriverWarning + WantVirtualBoxDriverWarning = "WantVirtualBoxDriverWarning" // ProfileName represents the key for the global profile parameter ProfileName = "profile" // UserFlag is the key for the global user flag (ex. --user=user1) diff --git a/pkg/minikube/node/start.go b/pkg/minikube/node/start.go index c8a79d0889..33ee50c99b 100644 --- a/pkg/minikube/node/start.go +++ b/pkg/minikube/node/start.go @@ -191,6 +191,23 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) { go addons.Start(&wg, starter.Cfg, starter.ExistingAddons, addonList) } + // discourage use of the virtualbox driver + if starter.Cfg.Driver == driver.VirtualBox && viper.GetBool(config.WantVirtualBoxDriverWarning) { + var altDriverList strings.Builder + for _, d := range driver.Choices(true) { + if d.Name != "virtualbox" { + altDriverList.WriteString(fmt.Sprintf("\t- %s\n", d.Name)) + } + } + + out.ErrT(style.Empty, "") + out.WarningT("The 'virtualbox' driver could be troublesome to work with, do not use if you aren't familiar with it") + out.ErrT(style.Tip, "You could instead use one of the drivers listed below:") + out.ErrT(style.Empty, altDriverList.String()) + out.ErrT(style.Documentation, "For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/virtualbox/") + out.ErrT(style.Empty, "") + } + if apiServer { // special ops for none , like change minikube directory. // multinode super doesn't work on the none driver diff --git a/site/content/en/docs/commands/config.md b/site/content/en/docs/commands/config.md index b6b4016965..75f99b44e3 100644 --- a/site/content/en/docs/commands/config.md +++ b/site/content/en/docs/commands/config.md @@ -30,6 +30,7 @@ Configurable fields: * WantBetaUpdateNotification * ReminderWaitPeriodInHours * WantNoneDriverWarning + * WantVirtualBoxDriverWarning * profile * bootstrapper * insecure-registry