From 9896386d03319d92a926b8a00a2afce62e1c2e05 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 16 Jul 2019 14:42:56 -0700 Subject: [PATCH] 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 801d0af370..7b7bd4bb4a 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 0000000000..8e466cd8e8 --- /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 0000000000..455404b7c2 --- /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("", "")) +}