From aa795deb2ea9a2fd92997ca2825dae5a50e77be1 Mon Sep 17 00:00:00 2001 From: dlorenc Date: Tue, 28 Nov 2017 08:27:19 -0800 Subject: [PATCH] Add deprecation notices for kvm and xhyve. --- cmd/minikube/cmd/root.go | 1 + pkg/minikube/cluster/cluster.go | 17 ++++++++++++++++- pkg/minikube/config/config.go | 13 +++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/cmd/minikube/cmd/root.go b/cmd/minikube/cmd/root.go index 34814994c08e..0f8bd5efcb19 100755 --- a/cmd/minikube/cmd/root.go +++ b/cmd/minikube/cmd/root.go @@ -162,6 +162,7 @@ func setupViper() { viper.SetDefault(config.WantReportError, false) viper.SetDefault(config.WantReportErrorPrompt, true) viper.SetDefault(config.WantKubectlDownloadMsg, true) + viper.SetDefault(config.ShowDriverDeprecationNotification, true) setFlagsUsingViper() } diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index e1ef207f81c9..7acccab7478e 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -38,6 +38,7 @@ import ( "github.com/docker/machine/libmachine/state" "github.com/golang/glog" "github.com/pkg/errors" + "github.com/spf13/viper" cfg "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" @@ -206,9 +207,23 @@ func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) { driver = createVirtualboxHost(config) case "vmwarefusion": driver = createVMwareFusionHost(config) - case "kvm", "kvm2": + case "kvm": + if viper.GetBool(cfg.ShowDriverDeprecationNotification) { + fmt.Fprintln(os.Stderr, `WARNING: The kvm driver is now deprecated and support for it will be removed in a future release. + Please consider switching to the kvm2 driver, which is intended to replace the kvm driver. + See https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver for more information. + To disable this message, run [minikube config set WantShowDriverDeprecationNotification false]`) + } + driver = createKVMHost(config) + case "kvm2": driver = createKVMHost(config) case "xhyve": + if viper.GetBool(cfg.ShowDriverDeprecationNotification) { + fmt.Fprintln(os.Stderr, `WARNING: The xhyve driver is now deprecated and support for it will be removed in a future release. +Please consider switching to the hyperkit driver, which is intended to replace the xhyve driver. +See https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperkit-driver for more information. +To disable this message, run [minikube config set WantShowDriverDeprecationNotification false]`) + } driver = createXhyveHost(config) case "hyperv": driver = createHypervHost(config) diff --git a/pkg/minikube/config/config.go b/pkg/minikube/config/config.go index ee0957e1afb0..5353f786bb89 100644 --- a/pkg/minikube/config/config.go +++ b/pkg/minikube/config/config.go @@ -28,12 +28,13 @@ import ( ) const ( - WantUpdateNotification = "WantUpdateNotification" - ReminderWaitPeriodInHours = "ReminderWaitPeriodInHours" - WantReportError = "WantReportError" - WantReportErrorPrompt = "WantReportErrorPrompt" - WantKubectlDownloadMsg = "WantKubectlDownloadMsg" - MachineProfile = "profile" + WantUpdateNotification = "WantUpdateNotification" + ReminderWaitPeriodInHours = "ReminderWaitPeriodInHours" + WantReportError = "WantReportError" + WantReportErrorPrompt = "WantReportErrorPrompt" + WantKubectlDownloadMsg = "WantKubectlDownloadMsg" + MachineProfile = "profile" + ShowDriverDeprecationNotification = "ShowDriverDeprecationNotification" ) type MinikubeConfig map[string]interface{}