diff --git a/cmd/minikube/cmd/config/config_test.go b/cmd/minikube/cmd/config/config_test.go index 5736897d648f..07388fef4edc 100644 --- a/cmd/minikube/cmd/config/config_test.go +++ b/cmd/minikube/cmd/config/config_test.go @@ -46,10 +46,10 @@ var configTestCases = []configTestCase{ "log_dir": "/etc/hosts", "show-libmachine-logs": true, "v": 5, - "vm-driver": "kvm" + "vm-driver": "kvm2" }`, config: map[string]interface{}{ - "vm-driver": constants.DriverKvmOld, + "vm-driver": constants.DriverKvm2, "cpus": 4, "disk-size": "20g", "v": 5, diff --git a/cmd/minikube/cmd/config/util_test.go b/cmd/minikube/cmd/config/util_test.go index 8e3e78ce1134..0f0cf189c83a 100644 --- a/cmd/minikube/cmd/config/util_test.go +++ b/cmd/minikube/cmd/config/util_test.go @@ -25,7 +25,7 @@ import ( ) var minikubeConfig = pkgConfig.MinikubeConfig{ - "vm-driver": constants.DriverKvmOld, + "vm-driver": constants.DriverKvm2, "cpus": 12, "show-libmachine-logs": true, } diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index e10086002aff..bb50c225787f 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -68,7 +68,6 @@ const ( cpus = "cpus" humanReadableDiskSize = "disk-size" vmDriver = "vm-driver" - xhyveDiskDriver = "xhyve-disk-driver" nfsSharesRoot = "nfs-shares-root" nfsShare = "nfs-share" kubernetesVersion = "kubernetes-version" @@ -163,7 +162,8 @@ func initKubernetesFlags() { // initDriverFlags inits the commandline flags for vm drivers func initDriverFlags() { startCmd.Flags().String(vmDriver, constants.DefaultVMDriver, fmt.Sprintf("VM driver is one of: %v", constants.SupportedVMDrivers)) - // kvm + + // kvm2 startCmd.Flags().String(kvmNetwork, "default", "The KVM network name. (only supported with KVM driver)") startCmd.Flags().String(kvmQemuURI, "qemu:///system", "The KVM QEMU connection URI. (works only with kvm2 driver on linux)") startCmd.Flags().Bool(kvmGPU, false, "Enable experimental NVIDIA GPU support in minikube") @@ -184,11 +184,6 @@ func initDriverFlags() { // hyperv startCmd.Flags().String(hypervVirtualSwitch, "", "The hyperv virtual switch name. Defaults to first found. (only supported with HyperV driver)") - - // xhyveDiskDriver - startCmd.Flags().String(xhyveDiskDriver, "ahci-hd", "The disk driver to use [ahci-hd|virtio-blk] (only supported with xhyve driver)") - startCmd.Flags().Bool(disableDriverMounts, false, "Disables the filesystem mounts provided by the hypervisors (vboxfs, xhyve-9p)") - } // initNetworkingFlags inits the commandline flags for connectivity related flags for start @@ -206,9 +201,8 @@ func initNetworkingFlags() { var startCmd = &cobra.Command{ Use: "start", Short: "Starts a local kubernetes cluster", - Long: `Starts a local kubernetes cluster using VM. This command -assumes you have already installed one of the VM drivers: virtualbox/parallels/vmwarefusion/kvm/xhyve/hyperv.`, - Run: runStart, + Long: "Starts a local kubernetes cluster", + Run: runStart, } // runStart handles the executes the flow of "minikube start" @@ -569,7 +563,6 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) { ContainerRuntime: viper.GetString(containerRuntime), HyperkitVpnKitSock: viper.GetString(vpnkitSock), HyperkitVSockPorts: viper.GetStringSlice(vsockPorts), - XhyveDiskDriver: viper.GetString(xhyveDiskDriver), NFSShare: viper.GetStringSlice(nfsShare), NFSSharesRoot: viper.GetString(nfsSharesRoot), DockerEnv: dockerEnv, diff --git a/docs/cli_commands.md b/docs/cli_commands.md index e10db275fd1d..34078095dd49 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -247,7 +247,7 @@ minikube service [command] --- ### start -**Description -** Starts a local kubernetes cluster using VM. This command assumes you have already installed one of the VM drivers: **virtualbox/parallels/vmwarefusion/kvm/xhyve/hyperv**. +**Description -** Starts a local kubernetes cluster. **Usage -** `minikube start [flags]` **Available Flags -** ``` @@ -259,7 +259,7 @@ minikube service [command] --container-runtime string The container runtime to be used (docker, crio, containerd) (default "docker") --cpus int Number of CPUs allocated to the minikube VM (default 2) --cri-socket string The cri socket path to be used - --disable-driver-mounts Disables the filesystem mounts provided by the hypervisors (vboxfs, xhyve-9p) + --disable-driver-mounts Disables the filesystem mounts provided by the hypervisors (vboxfs) --disk-size string Disk size allocated to the minikube VM (format: [], where unit = b, k, m or g) (default "20000mb") --dns-domain string The cluster dns domain name used in the kubernetes cluster (default "cluster.local") --docker-env stringArray Environment variables to pass to the Docker daemon. (format: key=value) @@ -295,8 +295,7 @@ minikube service [command] --registry-mirror strings Registry mirrors to pass to the Docker daemon --service-cluster-ip-range string The CIDR to be used for service cluster IPs. (default "10.96.0.0/12") --uuid string Provide VM UUID to restore MAC address (only supported with Hyperkit driver). - --vm-driver string VM driver is one of: [virtualbox parallels vmwarefusion kvm xhyve hyperv hyperkit kvm2 vmware none] (default "virtualbox") - --xhyve-disk-driver string The disk driver to use [ahci-hd|virtio-blk] (only supported with xhyve driver) (default "ahci-hd") + --vm-driver string VM driver is one of: [virtualbox parallels vmwarefusion kvm hyperv hyperkit kvm2 vmware none] (default "virtualbox") ``` --- diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index aea462263352..e6cc6d1503bf 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -321,32 +321,6 @@ func engineOptions(config cfg.MachineConfig) *engine.Options { return &o } -func preCreateHost(config *cfg.MachineConfig) { - switch config.VMDriver { - case constants.DriverKvmOld: - if viper.GetBool(cfg.ShowDriverDeprecationNotification) { - console.Warning(`The kvm driver is 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 ShowDriverDeprecationNotification false]`) - } - case constants.DriverXhyve: - if viper.GetBool(cfg.ShowDriverDeprecationNotification) { - console.Warning(`The xhyve driver is 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 ShowDriverDeprecationNotification false]`) - } - case constants.DriverVmwareFusion: - if viper.GetBool(cfg.ShowDriverDeprecationNotification) { - console.Warning(`The vmwarefusion driver is deprecated and support for it will be removed in a future release. - Please consider switching to the new vmware unified driver, which is intended to replace the vmwarefusion driver. - See https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#vmware-unified-driver for more information. - To disable this message, run [minikube config set ShowDriverDeprecationNotification false]`) - } - } -} - type hostInfo struct { Memory int CPUs int @@ -382,7 +356,12 @@ func getHostInfo() (*hostInfo, error) { } func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error) { - preCreateHost(&config) + if config.VMDriver == constants.DriverVmwareFusion && viper.GetBool(cfg.ShowDriverDeprecationNotification) { + console.Warning(`The vmwarefusion driver is deprecated and support for it will be removed in a future release. + Please consider switching to the new vmware unified driver, which is intended to replace the vmwarefusion driver. + See https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#vmware-unified-driver for more information. + To disable this message, run [minikube config set ShowDriverDeprecationNotification false]`) + } if config.VMDriver != constants.DriverNone { console.OutStyle(console.StartingVM, "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", config.VMDriver, config.CPUs, config.Memory, config.DiskSize) } else { @@ -452,8 +431,6 @@ func GetHostDockerEnv(api libmachine.API) (map[string]string, error) { // GetVMHostIP gets the ip address to be used for mapping host -> VM and VM -> host func GetVMHostIP(host *host.Host) (net.IP, error) { switch host.DriverName { - case constants.DriverKvmOld: - return net.ParseIP("192.168.42.1"), nil case constants.DriverKvm2: return net.ParseIP("192.168.39.1"), nil case constants.DriverHyperv: @@ -477,7 +454,7 @@ func GetVMHostIP(host *host.Host) (net.IP, error) { return []byte{}, errors.Wrap(err, "Error getting VM/Host IP address") } return ip, nil - case constants.DriverXhyve, constants.DriverHyperkit: + case constants.DriverHyperkit: return net.ParseIP("192.168.64.1"), nil case constants.DriverVmware: vmIPString, err := host.Driver.GetIP() diff --git a/pkg/minikube/cluster/default_drivers.go b/pkg/minikube/cluster/default_drivers.go index e45a1014490d..99dfe368f7f7 100644 --- a/pkg/minikube/cluster/default_drivers.go +++ b/pkg/minikube/cluster/default_drivers.go @@ -20,12 +20,10 @@ import ( // Import all the default drivers _ "k8s.io/minikube/pkg/minikube/drivers/hyperkit" _ "k8s.io/minikube/pkg/minikube/drivers/hyperv" - _ "k8s.io/minikube/pkg/minikube/drivers/kvm" _ "k8s.io/minikube/pkg/minikube/drivers/kvm2" _ "k8s.io/minikube/pkg/minikube/drivers/none" _ "k8s.io/minikube/pkg/minikube/drivers/parallels" _ "k8s.io/minikube/pkg/minikube/drivers/virtualbox" _ "k8s.io/minikube/pkg/minikube/drivers/vmware" _ "k8s.io/minikube/pkg/minikube/drivers/vmwarefusion" - _ "k8s.io/minikube/pkg/minikube/drivers/xhyve" ) diff --git a/pkg/minikube/config/config_test.go b/pkg/minikube/config/config_test.go index ecc13c5ce774..5384a8b41a9f 100644 --- a/pkg/minikube/config/config_test.go +++ b/pkg/minikube/config/config_test.go @@ -49,7 +49,7 @@ var configTestCases = []configTestCase{ "vm-driver": "kvm" }`, config: map[string]interface{}{ - "vm-driver": constants.DriverKvmOld, + "vm-driver": constants.DriverKvm2, "cpus": 4, "disk-size": "20g", "v": 5, diff --git a/pkg/minikube/config/types.go b/pkg/minikube/config/types.go index 8566c1a20b1b..8d9421ec142e 100644 --- a/pkg/minikube/config/types.go +++ b/pkg/minikube/config/types.go @@ -39,7 +39,6 @@ type MachineConfig struct { ContainerRuntime string HyperkitVpnKitSock string // Only used by the Hyperkit driver HyperkitVSockPorts []string // Only used by the Hyperkit driver - XhyveDiskDriver string // Only used by the xhyve driver DockerEnv []string // Each entry is formatted as KEY=VALUE. InsecureRegistry []string RegistryMirror []string @@ -51,7 +50,7 @@ type MachineConfig struct { KVMHidden bool // Only used by kvm2 Downloader util.ISODownloader `json:"-"` DockerOpt []string // Each entry is formatted as KEY=VALUE. - DisableDriverMounts bool // Only used by virtualbox and xhyve + DisableDriverMounts bool // Only used by virtualbox NFSShare []string NFSSharesRoot string UUID string // Only used by hyperkit to restore the mac address diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 101cacc7f1d5..af0adb783557 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -62,9 +62,6 @@ func ArchTag(hasTag bool) string { // DriverNone is the none driver. const DriverNone = "none" -// DriverKvmOld is the depricated kvm driver option name -const DriverKvmOld = "kvm" - // DriverKvm2 is the kvm2 driver option name for in linux const DriverKvm2 = "kvm2" @@ -83,9 +80,6 @@ const DriverVmwareFusion = "vmwarefusion" // DriverHyperv is the hyperv driver option for windows const DriverHyperv = "hyperv" -// DriverXhyve is the depricated xhyve driver option name -const DriverXhyve = "xhyve" - // DriverParallels is the parallels driver option name const DriverParallels = "parallels" diff --git a/pkg/minikube/constants/constants_darwin.go b/pkg/minikube/constants/constants_darwin.go index 91aa8fbb0b85..707f5f9925ff 100644 --- a/pkg/minikube/constants/constants_darwin.go +++ b/pkg/minikube/constants/constants_darwin.go @@ -25,7 +25,6 @@ var SupportedVMDrivers = [...]string{ DriverVirtualbox, DriverParallels, DriverVmwareFusion, - DriverXhyve, DriverHyperkit, DriverVmware, } diff --git a/pkg/minikube/constants/constants_gendocs.go b/pkg/minikube/constants/constants_gendocs.go index aee7b8b79864..19eceaf26b81 100644 --- a/pkg/minikube/constants/constants_gendocs.go +++ b/pkg/minikube/constants/constants_gendocs.go @@ -25,8 +25,6 @@ var SupportedVMDrivers = [...]string{ DriverVirtualbox, DriverParallels, DriverVmwareFusion, - DriverKvmOld, - DriverXhyve, DriverHyperv, DriverHyperkit, DriverKvm2, diff --git a/pkg/minikube/constants/constants_linux.go b/pkg/minikube/constants/constants_linux.go index b8596cad68bd..0fa300617fd6 100644 --- a/pkg/minikube/constants/constants_linux.go +++ b/pkg/minikube/constants/constants_linux.go @@ -30,7 +30,6 @@ var SupportedVMDrivers = [...]string{ DriverVirtualbox, DriverParallels, DriverVmwareFusion, - DriverKvmOld, DriverKvm2, DriverVmware, DriverNone, diff --git a/pkg/minikube/drivers/kvm/doc.go b/pkg/minikube/drivers/kvm/doc.go deleted file mode 100644 index d15b5fab9d71..000000000000 --- a/pkg/minikube/drivers/kvm/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kvm - -// doc... diff --git a/pkg/minikube/drivers/kvm/driver.go b/pkg/minikube/drivers/kvm/driver.go deleted file mode 100644 index 451712b4c7aa..000000000000 --- a/pkg/minikube/drivers/kvm/driver.go +++ /dev/null @@ -1,76 +0,0 @@ -// +build linux - -/* -Copyright 2018 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kvm - -import ( - "fmt" - "path/filepath" - - "github.com/docker/machine/libmachine/drivers" - cfg "k8s.io/minikube/pkg/minikube/config" - "k8s.io/minikube/pkg/minikube/constants" - "k8s.io/minikube/pkg/minikube/registry" -) - -func init() { - if err := registry.Register(registry.DriverDef{ - Name: constants.DriverKvmOld, - Builtin: false, - ConfigCreator: createKVMHost, - }); err != nil { - panic(fmt.Sprintf("register: %v", err)) - } -} - -// Delete this once the following PR is merged: -// https://github.com/dhiltgen/docker-machine-kvm/pull/68 -type kvmDriver struct { - *drivers.BaseDriver - - Memory int - DiskSize int - CPU int - Network string - PrivateNetwork string - ISO string - Boot2DockerURL string - DiskPath string - CacheMode string - IOMode string -} - -func createKVMHost(config cfg.MachineConfig) interface{} { - return &kvmDriver{ - BaseDriver: &drivers.BaseDriver{ - MachineName: cfg.GetMachineName(), - StorePath: constants.GetMinipath(), - SSHUser: "docker", - }, - Memory: config.Memory, - CPU: config.CPUs, - Network: config.KVMNetwork, - PrivateNetwork: "docker-machines", - Boot2DockerURL: config.Downloader.GetISOFileURI(config.MinikubeISO), - DiskSize: config.DiskSize, - DiskPath: filepath.Join(constants.GetMinipath(), "machines", cfg.GetMachineName(), fmt.Sprintf("%s.rawdisk", cfg.GetMachineName())), - ISO: filepath.Join(constants.GetMinipath(), "machines", cfg.GetMachineName(), "boot2docker.iso"), - CacheMode: "default", - IOMode: "threads", - } -} diff --git a/pkg/minikube/drivers/xhyve/doc.go b/pkg/minikube/drivers/xhyve/doc.go deleted file mode 100644 index 1d8c8b5ae3e8..000000000000 --- a/pkg/minikube/drivers/xhyve/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package xhyve diff --git a/pkg/minikube/drivers/xhyve/driver.go b/pkg/minikube/drivers/xhyve/driver.go deleted file mode 100644 index 3fc0ae21fbb0..000000000000 --- a/pkg/minikube/drivers/xhyve/driver.go +++ /dev/null @@ -1,88 +0,0 @@ -// +build darwin - -/* -Copyright 2018 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package xhyve - -import ( - "fmt" - "os" - - "github.com/docker/machine/libmachine/drivers" - cfg "k8s.io/minikube/pkg/minikube/config" - "k8s.io/minikube/pkg/minikube/constants" - "k8s.io/minikube/pkg/minikube/registry" -) - -const errMsg = ` -The Xhyve driver is not included in minikube yet. Please follow the directions at -https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#xhyve-driver -` - -func init() { - if err := registry.Register(registry.DriverDef{ - Name: constants.DriverXhyve, - Builtin: false, - ConfigCreator: createXhyveHost, - DriverCreator: func() drivers.Driver { - fmt.Fprintln(os.Stderr, errMsg) - os.Exit(1) - return nil - }, - }); err != nil { - panic(fmt.Sprintf("register: %v", err)) - } -} - -type xhyveDriver struct { - *drivers.BaseDriver - - Boot2DockerURL string - BootCmd string - CPU int - CaCertPath string - DiskSize int64 - MacAddr string - Memory int - PrivateKeyPath string - UUID string - NFSShare bool - DiskNumber int - Virtio9p bool - Virtio9pFolder string - QCow2 bool - RawDisk bool -} - -func createXhyveHost(config cfg.MachineConfig) interface{} { - useVirtio9p := !config.DisableDriverMounts - return &xhyveDriver{ - BaseDriver: &drivers.BaseDriver{ - MachineName: cfg.GetMachineName(), - StorePath: constants.GetMinipath(), - }, - Memory: config.Memory, - CPU: config.CPUs, - Boot2DockerURL: config.Downloader.GetISOFileURI(config.MinikubeISO), - BootCmd: "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=" + cfg.GetMachineName(), - DiskSize: int64(config.DiskSize), - Virtio9p: useVirtio9p, - Virtio9pFolder: "/Users", - QCow2: false, - RawDisk: config.XhyveDiskDriver == "virtio-blk", - } -}