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..6e1e435714 100644 --- a/pkg/minikube/node/start.go +++ b/pkg/minikube/node/start.go @@ -61,6 +61,7 @@ import ( "k8s.io/minikube/pkg/minikube/out/register" "k8s.io/minikube/pkg/minikube/proxy" "k8s.io/minikube/pkg/minikube/reason" + "k8s.io/minikube/pkg/minikube/registry" "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/minikube/vmpath" "k8s.io/minikube/pkg/util" @@ -191,6 +192,11 @@ 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) { + warnVirtualBox() + } + if apiServer { // special ops for none , like change minikube directory. // multinode super doesn't work on the none driver @@ -731,3 +737,28 @@ func addCoreDNSEntry(runner command.Runner, name, ip string, cc config.ClusterCo return nil } + +// prints a warning to the console against the use of the 'virtualbox' driver, if alternatives are available and healthy +func warnVirtualBox() { + var altDriverList strings.Builder + for _, choice := range driver.Choices(true) { + if choice.Name != "virtualbox" && choice.Priority != registry.Discouraged && choice.State.Installed && choice.State.Healthy { + altDriverList.WriteString(fmt.Sprintf("\n\t- %s", choice.Name)) + } + } + + if altDriverList.Len() != 0 { + out.Boxed(`You have selected "virtualbox" driver, but there are better options ! +For better performance and support consider using a different driver: {{.drivers}} + +To turn off this warning run: + + $ minikube config set WantVirtualBoxDriverWarning false + + +To learn more about on minikube drivers checkout https://minikube.sigs.k8s.io/docs/drivers/ +To see benchmarks checkout https://minikube.sigs.k8s.io/docs/benchmarks/cpuusage/ + +`, out.V{"drivers": altDriverList.String()}) + } +} 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