未验证 提交 26231437 编写于 作者: T Thomas Strömberg 提交者: GitHub

Merge pull request #4781 from tstromberg/not-an-err

Remove deprecated drivers: kvm-old and xhyve
......@@ -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,
......
......@@ -25,7 +25,7 @@ import (
)
var minikubeConfig = pkgConfig.MinikubeConfig{
"vm-driver": constants.DriverKvmOld,
"vm-driver": constants.DriverKvm2,
"cpus": 12,
"show-libmachine-logs": true,
}
......
......@@ -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,
......
......@@ -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: <number>[<unit>], 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")
```
---
......
......@@ -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()
......
......@@ -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"
)
......@@ -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,
......
......@@ -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
......
......@@ -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"
......
......@@ -25,7 +25,6 @@ var SupportedVMDrivers = [...]string{
DriverVirtualbox,
DriverParallels,
DriverVmwareFusion,
DriverXhyve,
DriverHyperkit,
DriverVmware,
}
......@@ -25,8 +25,6 @@ var SupportedVMDrivers = [...]string{
DriverVirtualbox,
DriverParallels,
DriverVmwareFusion,
DriverKvmOld,
DriverXhyve,
DriverHyperv,
DriverHyperkit,
DriverKvm2,
......
......@@ -30,7 +30,6 @@ var SupportedVMDrivers = [...]string{
DriverVirtualbox,
DriverParallels,
DriverVmwareFusion,
DriverKvmOld,
DriverKvm2,
DriverVmware,
DriverNone,
......
/*
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...
// +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",
}
}
/*
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
// +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",
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册