From a1cd81bf1c26461752d66671c66af496da303edb Mon Sep 17 00:00:00 2001 From: Denis Denisov Date: Fri, 18 Jan 2019 08:13:19 +0200 Subject: [PATCH] machine: add parallels support --- cmd/minikube/cmd/start.go | 2 +- pkg/minikube/constants/constants.go | 1 + pkg/minikube/drivers/parallels/doc.go | 17 +++++++++ pkg/minikube/drivers/parallels/driver.go | 48 ++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pkg/minikube/drivers/parallels/doc.go create mode 100644 pkg/minikube/drivers/parallels/driver.go diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index d20efb646161..bc9ee31752bc 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -95,7 +95,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/vmwarefusion/kvm/xhyve/hyperv.`, +assumes you have already installed one of the VM drivers: virtualbox/parallels/vmwarefusion/kvm/xhyve/hyperv.`, Run: runStart, } diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 4e8d3801eb55..47586126b852 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -54,6 +54,7 @@ func GetMinipath() string { // used in gendocs. var SupportedVMDrivers = [...]string{ "virtualbox", + "parallels", "vmwarefusion", "kvm", "xhyve", diff --git a/pkg/minikube/drivers/parallels/doc.go b/pkg/minikube/drivers/parallels/doc.go new file mode 100644 index 000000000000..e216ec23bf61 --- /dev/null +++ b/pkg/minikube/drivers/parallels/doc.go @@ -0,0 +1,17 @@ +/* +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 parallels diff --git a/pkg/minikube/drivers/parallels/driver.go b/pkg/minikube/drivers/parallels/driver.go new file mode 100644 index 000000000000..36d051a972e7 --- /dev/null +++ b/pkg/minikube/drivers/parallels/driver.go @@ -0,0 +1,48 @@ +// +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 parallels + +import ( + parallels "github.com/Parallels/docker-machine-parallels" + "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() { + registry.Register(registry.DriverDef{ + Name: "parallels", + Builtin: true, + ConfigCreator: createParallelsHost, + DriverCreator: func() drivers.Driver { + return parallels.NewDriver("", "") + }, + }) +} + +func createParallelsHost(config cfg.MachineConfig) interface{} { + d := parallels.NewDriver(cfg.GetMachineName(), constants.GetMinipath()).(*parallels.Driver) + d.Boot2DockerURL = config.Downloader.GetISOFileURI(config.MinikubeISO) + d.Memory = config.Memory + d.CPU = config.CPUs + d.DiskSize = config.DiskSize + d.ISO = d.ResolveStorePath("boot2docker.iso") + return d +}