From 2ed16a11987fc1a683f81069f156bda36b13bffd Mon Sep 17 00:00:00 2001 From: josedonizetti Date: Thu, 11 Jul 2019 10:35:16 -0300 Subject: [PATCH] Move supported drivers per platform --- Makefile | 2 +- pkg/minikube/constants/constants.go | 15 --------- pkg/minikube/constants/constants_darwin.go | 12 ++++++- pkg/minikube/constants/constants_gendocs.go | 35 +++++++++++++++++++++ pkg/minikube/constants/constants_linux.go | 13 +++++++- pkg/minikube/constants/constants_windows.go | 10 +++++- 6 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 pkg/minikube/constants/constants_gendocs.go diff --git a/Makefile b/Makefile index 661fa59dbec8..1e2ecbbf5545 100755 --- a/Makefile +++ b/Makefile @@ -288,7 +288,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) diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 934ba428cf4d..a058873e0653 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -89,21 +89,6 @@ const DriverXhyve = "xhyve" // DriverParallels is the parallels driver option name const DriverParallels = "parallels" -// SupportedVMDrivers is a list of supported drivers on all platforms. Currently -// used in gendocs. -var SupportedVMDrivers = [...]string{ - DriverVirtualbox, - DriverParallels, - DriverVmwareFusion, - DriverKvmOld, - DriverXhyve, - DriverHyperv, - DriverHyperkit, - DriverKvm2, - DriverVmware, - DriverNone, -} - // DefaultMinipath is the default Minikube path (under the home directory) var DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube") diff --git a/pkg/minikube/constants/constants_darwin.go b/pkg/minikube/constants/constants_darwin.go index 081ffea3fecf..2d4e8163ee95 100644 --- a/pkg/minikube/constants/constants_darwin.go +++ b/pkg/minikube/constants/constants_darwin.go @@ -1,4 +1,4 @@ -// +build darwin +// +build darwin, !gendocs /* Copyright 2016 The Kubernetes Authors All rights reserved. @@ -19,3 +19,13 @@ limitations under the License. package constants var DefaultMountDir = "/Users" + +// SupportedVMDrivers is a list of supported drivers on Darwin. +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 new file mode 100644 index 000000000000..aee7b8b79864 --- /dev/null +++ b/pkg/minikube/constants/constants_gendocs.go @@ -0,0 +1,35 @@ +// +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 + +var DefaultMountDir = "$HOME" + +// SupportedVMDrivers is a list of supported drivers on all platforms. +var SupportedVMDrivers = [...]string{ + DriverVirtualbox, + DriverParallels, + DriverVmwareFusion, + DriverKvmOld, + DriverXhyve, + DriverHyperv, + DriverHyperkit, + DriverKvm2, + DriverVmware, + DriverNone, +} diff --git a/pkg/minikube/constants/constants_linux.go b/pkg/minikube/constants/constants_linux.go index a5419b777190..b8596cad68bd 100644 --- a/pkg/minikube/constants/constants_linux.go +++ b/pkg/minikube/constants/constants_linux.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux, !gendocs /* Copyright 2016 The Kubernetes Authors All rights reserved. @@ -24,3 +24,14 @@ import ( // DefaultMountDir is the default mount dir var DefaultMountDir = homedir.HomeDir() + +// SupportedVMDrivers is a list of supported drivers on Linux. +var SupportedVMDrivers = [...]string{ + DriverVirtualbox, + DriverParallels, + DriverVmwareFusion, + DriverKvmOld, + DriverKvm2, + DriverVmware, + DriverNone, +} diff --git a/pkg/minikube/constants/constants_windows.go b/pkg/minikube/constants/constants_windows.go index aa66af22a660..fb0139964a01 100644 --- a/pkg/minikube/constants/constants_windows.go +++ b/pkg/minikube/constants/constants_windows.go @@ -1,4 +1,4 @@ -// +build windows +// +build windows, !gendocs /* Copyright 2016 The Kubernetes Authors All rights reserved. @@ -23,3 +23,11 @@ import ( ) var DefaultMountDir = homedir.HomeDir() + +// SupportedVMDrivers is a list of supported drivers on Windows. +var SupportedVMDrivers = [...]string{ + DriverVirtualbox, + DriverVmwareFusion, + DriverHyperv, + DriverVmware, +}