Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hyperkit version #4593

Merged
merged 3 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ SOURCE_PACKAGES = ./cmd/... ./pkg/... ./test/...
# kvm2 ldflags
KVM2_LDFLAGS := -X k8s.io/minikube/pkg/drivers/kvm.version=$(VERSION) -X k8s.io/minikube/pkg/drivers/kvm.gitCommitID=$(COMMIT)

# hyperkit ldflags
HYPERKIT_LDFLAGS := -X k8s.io/minikube/pkg/drivers/hyperkit.version=$(VERSION) -X k8s.io/minikube/pkg/drivers/hyperkit.gitCommitID=$(COMMIT)

# $(call DOCKER, image, command)
define DOCKER
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) -w /app -v $(PWD):/app -v $(GOPATH):/go --entrypoint /bin/bash $(1) -c '$(2)'
Expand Down Expand Up @@ -329,7 +332,9 @@ out/docker-machine-driver-hyperkit:
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@)
else
GOOS=darwin CGO_ENABLED=1 go build -o $(BUILD_DIR)/docker-machine-driver-hyperkit k8s.io/minikube/cmd/drivers/hyperkit
GOOS=darwin CGO_ENABLED=1 go build \
-ldflags="$(HYPERKIT_LDFLAGS)" \
-o $(BUILD_DIR)/docker-machine-driver-hyperkit k8s.io/minikube/cmd/drivers/hyperkit
endif

.PHONY: install-hyperkit-driver
Expand Down
9 changes: 9 additions & 0 deletions cmd/drivers/hyperkit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ limitations under the License.
package main

import (
"fmt"
"os"

"github.com/docker/machine/libmachine/drivers/plugin"
"k8s.io/minikube/pkg/drivers/hyperkit"
)

func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
fmt.Println("version:", hyperkit.GetVersion())
fmt.Println("commit:", hyperkit.GetGitCommitID())
return
}

plugin.RegisterDriver(hyperkit.NewDriver("", ""))
}
8 changes: 8 additions & 0 deletions docs/drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ or, to use hyperkit as a default driver for minikube:
minikube config set vm-driver hyperkit
```

### Troubleshoot

Make sure you are running the lastest version of your driver.

```shell
docker-machine-driver-hyperkit version
```

## HyperV driver

Hyper-v users may need to create a new external network switch as described [here](https://docs.docker.com/machine/drivers/hyper-v/). This step may prevent a problem in which `minikube start` hangs indefinitely, unable to ssh into the minikube virtual machine. In this add, add the `--hyperv-virtual-switch=switch-name` argument to the `minikube start` command.
Expand Down
35 changes: 35 additions & 0 deletions pkg/drivers/hyperkit/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
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 hyperkit

// The current version of the docker-machine-driver-hyperkit

// version is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/hyperkit.version=vX.Y.Z"
medyagh marked this conversation as resolved.
Show resolved Hide resolved
var version = "v0.0.0-unset"

// gitCommitID is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/hyperkit.gitCommitID=<commit-id>"
var gitCommitID = ""

// GetVersion returns the current docker-machine-driver-hyperkit version
func GetVersion() string {
return version
}

// GetGitCommitID returns the git commit id from which it is being built
func GetGitCommitID() string {
return gitCommitID
}