Remove OS dependent SupportedVMDrivers

Use ListDrivers() method to get the list of VM drivers.
SupportedVMDrivers become the whole list of VM drivers on all
platforms, which is used in gendocs only.
pull/2600/head
Yongkun Anfernee Gui 2018-02-09 11:19:19 -08:00 committed by dlorenc
parent 1057edfa8f
commit ab9f3b234d
7 changed files with 16 additions and 58 deletions

View File

@ -233,7 +233,7 @@ fmt:
@gofmt -l -s -w $(SOURCE_DIRS)
out/docs/minikube.md: $(shell find cmd) $(shell find pkg/minikube/constants) pkg/minikube/assets/assets.go
cd $(GOPATH)/src/$(REPOPATH) && go run -ldflags="$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS)" -tags gendocs hack/gen_help_text.go
cd $(GOPATH)/src/$(REPOPATH) && go run -ldflags="$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS)" hack/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)

View File

@ -67,7 +67,7 @@ func TestCreateHost(t *testing.T) {
}
found := false
for _, driver := range constants.SupportedVMDrivers {
for _, driver := range ListDrivers() {
if h.DriverName == driver {
found = true
break
@ -75,7 +75,7 @@ func TestCreateHost(t *testing.T) {
}
if !found {
t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion, kvm or xhyve.", h.DriverName)
t.Fatalf("Wrong driver name: %v. Should be among %v", h.DriverName, ListDrivers())
}
}

View File

@ -46,6 +46,16 @@ func GetMinipath() string {
return filepath.Join(os.Getenv(MinikubeHome), ".minikube")
}
// SupportedVMDrivers is a list of supported drivers on all platforms. Currently
// used in gendocs.
var SupportedVMDrivers = [...]string{
"virtualbox",
"vmwarefusion",
"kvm",
"xhyve",
"hyperv",
}
var DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube")
// KubeconfigPath is the path to the Kubernetes client config

View File

@ -1,4 +1,4 @@
// +build darwin,!gendocs
// +build darwin
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
@ -18,11 +18,4 @@ limitations under the License.
package constants
var SupportedVMDrivers = [...]string{
"virtualbox",
"xhyve",
"vmwarefusion",
"hyperkit",
}
var DefaultMountDir = "/Users"

View File

@ -1,33 +0,0 @@
// +build gendocs
/*
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 constants
import (
"k8s.io/client-go/util/homedir"
)
var SupportedVMDrivers = [...]string{
"virtualbox",
"vmwarefusion",
"kvm",
"xhyve",
"hyperv",
}
var DefaultMountDir = homedir.HomeDir()

View File

@ -1,4 +1,4 @@
// +build linux,!gendocs
// +build linux
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
@ -22,11 +22,4 @@ import (
"k8s.io/client-go/util/homedir"
)
var SupportedVMDrivers = [...]string{
"virtualbox",
"kvm",
"kvm2",
"none",
}
var DefaultMountDir = homedir.HomeDir()

View File

@ -1,4 +1,4 @@
// +build windows,!gendocs
// +build windows
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
@ -22,9 +22,4 @@ import (
"k8s.io/client-go/util/homedir"
)
var SupportedVMDrivers = [...]string{
"virtualbox",
"hyperv",
}
var DefaultMountDir = homedir.HomeDir()