From 914713f3887cb3a1c40d4dbc706520b8b24a972c Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 16 Jul 2019 13:40:00 -0700 Subject: [PATCH 1/8] Remove deprrecated drivers: kvm-old and xhyve --- cmd/drivers/kvm/main-nolinux.go | 33 ---------- cmd/drivers/kvm/main.go | 37 ----------- cmd/minikube/cmd/config/config_test.go | 2 +- cmd/minikube/cmd/start.go | 7 +- docs/cli_commands.md | 7 +- pkg/minikube/cluster/cluster.go | 14 ---- pkg/minikube/cluster/default_drivers.go | 4 +- pkg/minikube/config/types.go | 3 +- pkg/minikube/constants/constants.go | 6 -- pkg/minikube/drivers/kvm/doc.go | 19 ------ pkg/minikube/drivers/kvm/driver.go | 76 --------------------- pkg/minikube/drivers/xhyve/doc.go | 17 ----- pkg/minikube/drivers/xhyve/driver.go | 88 ------------------------- 13 files changed, 8 insertions(+), 305 deletions(-) delete mode 100644 cmd/drivers/kvm/main-nolinux.go delete mode 100644 cmd/drivers/kvm/main.go delete mode 100644 pkg/minikube/drivers/kvm/doc.go delete mode 100644 pkg/minikube/drivers/kvm/driver.go delete mode 100644 pkg/minikube/drivers/xhyve/doc.go delete mode 100644 pkg/minikube/drivers/xhyve/driver.go diff --git a/cmd/drivers/kvm/main-nolinux.go b/cmd/drivers/kvm/main-nolinux.go deleted file mode 100644 index 8e466cd8e8ac..000000000000 --- a/cmd/drivers/kvm/main-nolinux.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build !linux - -/* -Copyright 2016 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 main - -import ( - "fmt" - "os" -) - -func main() { - fmt.Println( - "this driver was built on a non-linux machine, so it is " + - "unavailable. Please re-build minikube on a linux machine to enable " + - "it.", - ) - os.Exit(1) -} diff --git a/cmd/drivers/kvm/main.go b/cmd/drivers/kvm/main.go deleted file mode 100644 index 455404b7c2ef..000000000000 --- a/cmd/drivers/kvm/main.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build linux - -/* -Copyright 2016 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 main - -import ( - "fmt" - "os" - - "github.com/docker/machine/libmachine/drivers/plugin" - "k8s.io/minikube/pkg/drivers/kvm" -) - -func main() { - if len(os.Args) > 1 && os.Args[1] == "version" { - fmt.Println("version:", kvm.GetVersion()) - fmt.Println("commit:", kvm.GetGitCommitID()) - return - } - - plugin.RegisterDriver(kvm.NewDriver("", "")) -} diff --git a/cmd/minikube/cmd/config/config_test.go b/cmd/minikube/cmd/config/config_test.go index 5736897d648f..098f89418dad 100644 --- a/cmd/minikube/cmd/config/config_test.go +++ b/cmd/minikube/cmd/config/config_test.go @@ -46,7 +46,7 @@ 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, diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 7920d575b605..c686b73322f7 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" @@ -118,7 +117,7 @@ func init() { startCmd.Flags().Bool(keepContext, constants.DefaultKeepContext, "This will keep the existing kubectl context and will create a minikube context.") startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube") startCmd.Flags().String(mountString, constants.DefaultMountDir+":"+constants.DefaultMountEndpoint, "The argument to pass the minikube mount command on start") - startCmd.Flags().Bool(disableDriverMounts, false, "Disables the filesystem mounts provided by the hypervisors (vboxfs, xhyve-9p)") + startCmd.Flags().Bool(disableDriverMounts, false, "Disables the filesystem mounts provided by the hypervisors (vboxfs)") startCmd.Flags().String(isoURL, constants.DefaultISOURL, "Location of the minikube iso") startCmd.Flags().String(vmDriver, constants.DefaultVMDriver, fmt.Sprintf("VM driver is one of: %v", constants.SupportedVMDrivers)) startCmd.Flags().String(memory, constants.DefaultMemorySize, "Amount of RAM allocated to the minikube VM (format: [], where unit = b, k, m or g)") @@ -130,7 +129,6 @@ func init() { 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") startCmd.Flags().Bool(kvmHidden, false, "Hide the hypervisor signature from the guest in minikube") - startCmd.Flags().String(xhyveDiskDriver, "ahci-hd", "The disk driver to use [ahci-hd|virtio-blk] (only supported with xhyve driver)") startCmd.Flags().StringSlice(nfsShare, []string{}, "Local folders to share with Guest via NFS mounts (Only supported on with hyperkit now)") startCmd.Flags().String(nfsSharesRoot, "/nfsshares", "Where to root the NFS Shares (defaults to /nfsshares, only supported with hyperkit now)") startCmd.Flags().StringArrayVar(&dockerEnv, "docker-env", nil, "Environment variables to pass to the Docker daemon. (format: key=value)") @@ -175,7 +173,7 @@ 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.`, +assumes you have already installed one of the VM drivers: virtualbox/parallels/vmwarefusion/kvm/hyperv.`, Run: runStart, } @@ -529,7 +527,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..79062717fcad 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 using VM. This command assumes you have already installed one of the VM drivers: **virtualbox/parallels/vmwarefusion/kvm/hyperv**. **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 39d6e06c8b14..6be1d6fa61e8 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -320,20 +320,6 @@ func engineOptions(config cfg.MachineConfig) *engine.Options { 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. diff --git a/pkg/minikube/cluster/default_drivers.go b/pkg/minikube/cluster/default_drivers.go index e45a1014490d..06a09ae3745c 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/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 63bb6ccaa52c..71a42300e37d 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/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", - } -} From 6729f6cfe4faccb663a19314cb72637f91aa1d25 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 16 Jul 2019 13:54:24 -0700 Subject: [PATCH 2/8] Remove remaining DriverXhyve and DriverKvmOld references --- pkg/minikube/cluster/cluster.go | 4 +--- pkg/minikube/cluster/default_drivers.go | 2 +- pkg/minikube/constants/constants.go | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index 6be1d6fa61e8..4ca0a87b4b79 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -393,8 +393,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: @@ -418,7 +416,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 06a09ae3745c..99dfe368f7f7 100644 --- a/pkg/minikube/cluster/default_drivers.go +++ b/pkg/minikube/cluster/default_drivers.go @@ -26,4 +26,4 @@ import ( _ "k8s.io/minikube/pkg/minikube/drivers/virtualbox" _ "k8s.io/minikube/pkg/minikube/drivers/vmware" _ "k8s.io/minikube/pkg/minikube/drivers/vmwarefusion" - +) diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 71a42300e37d..2038c3cc6a07 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -89,8 +89,6 @@ var SupportedVMDrivers = [...]string{ DriverVirtualbox, DriverParallels, DriverVmwareFusion, - DriverKvmOld, - DriverXhyve, DriverHyperv, DriverHyperkit, DriverKvm2, From 9896386d03319d92a926b8a00a2afce62e1c2e05 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 16 Jul 2019 14:42:56 -0700 Subject: [PATCH 3/8] Fix docker-machine-driver-kvm2 build --- Makefile | 2 +- cmd/drivers/kvm/main-nolinux.go | 33 +++++++++++++++++++++++++++++ cmd/drivers/kvm/main.go | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 cmd/drivers/kvm/main-nolinux.go create mode 100644 cmd/drivers/kvm/main.go diff --git a/Makefile b/Makefile index 801d0af370a9..7b7bd4bb4a33 100755 --- a/Makefile +++ b/Makefile @@ -413,7 +413,7 @@ release-minikube: out/minikube checksum gsutil cp out/minikube-$(GOOS)-$(GOARCH) $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH) gsutil cp out/minikube-$(GOOS)-$(GOARCH).sha256 $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH).sha256 -out/docker-machine-driver-kvm2: +out/docker-machine-driver-kvm2: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go go build \ -installsuffix "static" \ -ldflags="$(KVM2_LDFLAGS)" \ diff --git a/cmd/drivers/kvm/main-nolinux.go b/cmd/drivers/kvm/main-nolinux.go new file mode 100644 index 000000000000..8e466cd8e8ac --- /dev/null +++ b/cmd/drivers/kvm/main-nolinux.go @@ -0,0 +1,33 @@ +// +build !linux + +/* +Copyright 2016 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 main + +import ( + "fmt" + "os" +) + +func main() { + fmt.Println( + "this driver was built on a non-linux machine, so it is " + + "unavailable. Please re-build minikube on a linux machine to enable " + + "it.", + ) + os.Exit(1) +} diff --git a/cmd/drivers/kvm/main.go b/cmd/drivers/kvm/main.go new file mode 100644 index 000000000000..455404b7c2ef --- /dev/null +++ b/cmd/drivers/kvm/main.go @@ -0,0 +1,37 @@ +// +build linux + +/* +Copyright 2016 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 main + +import ( + "fmt" + "os" + + "github.com/docker/machine/libmachine/drivers/plugin" + "k8s.io/minikube/pkg/drivers/kvm" +) + +func main() { + if len(os.Args) > 1 && os.Args[1] == "version" { + fmt.Println("version:", kvm.GetVersion()) + fmt.Println("commit:", kvm.GetGitCommitID()) + return + } + + plugin.RegisterDriver(kvm.NewDriver("", "")) +} From d0ae6e9d3be0a2c071f8e1778efffe5865507008 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 16 Jul 2019 15:16:51 -0700 Subject: [PATCH 4/8] Obsolete driver lint issues --- cmd/minikube/cmd/config/config_test.go | 2 +- cmd/minikube/cmd/config/util_test.go | 2 +- pkg/minikube/cluster/cluster.go | 20 +++++++------------- pkg/minikube/config/config_test.go | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cmd/minikube/cmd/config/config_test.go b/cmd/minikube/cmd/config/config_test.go index 098f89418dad..07388fef4edc 100644 --- a/cmd/minikube/cmd/config/config_test.go +++ b/cmd/minikube/cmd/config/config_test.go @@ -49,7 +49,7 @@ var configTestCases = []configTestCase{ "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/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index 4ca0a87b4b79..0b9291f1a389 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -318,21 +318,15 @@ func engineOptions(config cfg.MachineConfig) *engine.Options { return &o } -func preCreateHost(config *cfg.MachineConfig) { - switch config.VMDriver { - 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]`) - } - } -} - func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error) { - preCreateHost(&config) console.OutStyle(console.StartingVM, "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", config.VMDriver, config.CPUs, config.Memory, config.DiskSize) + 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]`) + } + def, err := registry.Driver(config.VMDriver) if err != nil { if err == registry.ErrDriverNotFound { 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, From 7a81b7cf68f2d5b3cfe75f45116e8cce9ef4c493 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Wed, 17 Jul 2019 08:58:59 -0700 Subject: [PATCH 5/8] Remove hardcoded driver list from help docs --- cmd/minikube/cmd/start.go | 5 ++--- docs/cli_commands.md | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index c686b73322f7..63bebf2b0130 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -172,9 +172,8 @@ func init() { 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/hyperv.`, - Run: runStart, + Long: "Starts a local kubernetes cluster", + Run: runStart, } // runStart handles the executes the flow of "minikube start" diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 79062717fcad..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/hyperv**. +**Description -** Starts a local kubernetes cluster. **Usage -** `minikube start [flags]` **Available Flags -** ``` From 12c6d133ecec8c56a6cd9b271ac557543f64f242 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Wed, 17 Jul 2019 09:37:33 -0700 Subject: [PATCH 6/8] Revert docker-machine-driver-kvm2 dependency on assets --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2c749ffccf20..7b7bd4bb4a33 100755 --- a/Makefile +++ b/Makefile @@ -289,7 +289,7 @@ mdlint: @$(MARKDOWNLINT) $(MINIKUBE_MARKDOWN_FILES) out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go - go run -ldflags="$(MINIKUBE_LDFLAGS)" -tags gendocs hack/help_text/gen_help_text.go + go run -ldflags="$(MINIKUBE_LDFLAGS)" hack/help_text/gen_help_text.go out/minikube_$(DEB_VERSION).deb: out/minikube-linux-amd64 cp -r installers/linux/deb/minikube_deb_template out/minikube_$(DEB_VERSION) From 649d419b82642a5a6566f7c2398a9384440292b9 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Wed, 17 Jul 2019 09:39:13 -0700 Subject: [PATCH 7/8] Revert "Revert docker-machine-driver-kvm2 dependency on assets" This reverts commit 12c6d133ecec8c56a6cd9b271ac557543f64f242. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b7bd4bb4a33..2c749ffccf20 100755 --- a/Makefile +++ b/Makefile @@ -289,7 +289,7 @@ mdlint: @$(MARKDOWNLINT) $(MINIKUBE_MARKDOWN_FILES) out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go - go run -ldflags="$(MINIKUBE_LDFLAGS)" hack/help_text/gen_help_text.go + go run -ldflags="$(MINIKUBE_LDFLAGS)" -tags gendocs hack/help_text/gen_help_text.go out/minikube_$(DEB_VERSION).deb: out/minikube-linux-amd64 cp -r installers/linux/deb/minikube_deb_template out/minikube_$(DEB_VERSION) From 405906a6c96cdd5bc47c20c62a20bcddc74d4491 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Wed, 17 Jul 2019 09:39:42 -0700 Subject: [PATCH 8/8] Revert Makefile changes --- Makefile | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2c749ffccf20..2201fa3cbf36 100755 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE) cp $< $@ out/minikube-windows-amd64.exe: out/minikube-windows-amd64 - mv out/minikube-windows-amd64 out/minikube-windows-amd64.exe + cp out/minikube-windows-amd64 out/minikube-windows-amd64.exe out/minikube-%: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go $(shell find $(CMD_SOURCE_DIRS) -type f -name "*.go") ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y) @@ -129,7 +129,7 @@ e2e-%-$(GOARCH): out/minikube-%-$(GOARCH) GOOS=$* GOARCH=$(GOARCH) go test -c k8s.io/minikube/test/integration --tags="$(MINIKUBE_INTEGRATION_BUILD_TAGS)" -o out/$@ e2e-windows-amd64.exe: e2e-windows-amd64 - mv $(BUILD_DIR)/e2e-windows-amd64 $(BUILD_DIR)/e2e-windows-amd64.exe + cp $(BUILD_DIR)/e2e-windows-amd64 $(BUILD_DIR)/e2e-windows-amd64.exe minikube_iso: # old target kept for making tests happy echo $(ISO_VERSION) > deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/etc/VERSION @@ -331,7 +331,7 @@ out/minikube-%-amd64.tar.gz: $$(TAR_TARGETS_$$*) $(TAR_TARGETS_ALL) tar -cvf $@ $^ .PHONY: cross-tars -cross-tars: kvm_in_docker out/minikube-windows-amd64.tar.gz out/minikube-linux-amd64.tar.gz out/minikube-darwin-amd64.tar.gz +cross-tars: out/minikube-windows-amd64.tar.gz out/minikube-linux-amd64.tar.gz out/minikube-darwin-amd64.tar.gz out/minikube-installer.exe: out/minikube-windows-amd64.exe rm -rf out/windows_tmp @@ -413,13 +413,20 @@ release-minikube: out/minikube checksum gsutil cp out/minikube-$(GOOS)-$(GOARCH) $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH) gsutil cp out/minikube-$(GOOS)-$(GOARCH).sha256 $(MINIKUBE_UPLOAD_LOCATION)/$(MINIKUBE_VERSION)/minikube-$(GOOS)-$(GOARCH).sha256 -out/docker-machine-driver-kvm2: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go +out/docker-machine-driver-kvm2: +ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y) + docker pull $(KVM_BUILD_IMAGE) || $(MAKE) $(KVM_BUILD_IMAGE) + $(call DOCKER,$(KVM_BUILD_IMAGE),/usr/bin/make $@ COMMIT=$(COMMIT)) + # make extra sure that we are linking with the older version of libvirt (1.3.1) + test "`strings $@ | grep '^LIBVIRT_[0-9]' | sort | tail -n 1`" = "LIBVIRT_1.2.9" +else go build \ -installsuffix "static" \ -ldflags="$(KVM2_LDFLAGS)" \ - -tags libvirt.1.3.1 \ + -tags "libvirt.1.3.1 without_lxc" \ -o $(BUILD_DIR)/docker-machine-driver-kvm2 \ k8s.io/minikube/cmd/drivers/kvm +endif chmod +X $@ out/docker-machine-driver-kvm2_$(DEB_VERSION).deb: out/docker-machine-driver-kvm2 @@ -446,15 +453,15 @@ $(KVM_BUILD_IMAGE): installers/linux/kvm/Dockerfile @echo "$(@) successfully built" kvm_in_docker: - docker inspect $(KVM_BUILD_IMAGE) || $(MAKE) $(KVM_BUILD_IMAGE) + docker inspect -f '{{.Id}} {{.RepoTags}}' $(KVM_BUILD_IMAGE) || $(MAKE) $(KVM_BUILD_IMAGE) rm -f out/docker-machine-driver-kvm2 $(call DOCKER,$(KVM_BUILD_IMAGE),/usr/bin/make out/docker-machine-driver-kvm2 COMMIT=$(COMMIT)) -.PHONY: install-kvm -install-kvm: out/docker-machine-driver-kvm2 +.PHONY: install-kvm-driver +install-kvm-driver: out/docker-machine-driver-kvm2 cp out/docker-machine-driver-kvm2 $(GOBIN)/docker-machine-driver-kvm2 .PHONY: release-kvm-driver -release-kvm-driver: kvm_in_docker checksum install-kvm +release-kvm-driver: install-kvm-driver checksum gsutil cp $(GOBIN)/docker-machine-driver-kvm2 gs://minikube/drivers/kvm/$(VERSION)/ gsutil cp $(GOBIN)/docker-machine-driver-kvm2.sha256 gs://minikube/drivers/kvm/$(VERSION)/