-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WIP: Initial hyperkit driver implementation. #1776
Conversation
@dlorenc SGTM. Thanks for port of my code :) |
@dlorenc But FYI, zchee/go-vmnet is unstable. If you don't mind, it might be better to copy all file to minikube. |
Thanks, I'll definitely vendor it in. |
2ac1dd6
to
f197143
Compare
@minikube-bot test this please |
e1d5207
to
e60bf66
Compare
Codecov Report
@@ Coverage Diff @@
## master #1776 +/- ##
=========================================
+ Coverage 32.73% 32.94% +0.2%
=========================================
Files 66 69 +3
Lines 4112 4250 +138
=========================================
+ Hits 1346 1400 +54
- Misses 2571 2650 +79
- Partials 195 200 +5
Continue to review full report at Codecov.
|
@minikube-bot test this please |
Eagerly anticipating this! Thanks for your work, @dlorenc and @zchee.
Should I just be patient and wait for this to make it in for real, or is there a small tweak I can make to make it work now? 😁 |
Could you open an issue and attach the logs of |
@r2d4 this should be ready for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome. Just a few comments.
Makefile
Outdated
@@ -207,6 +207,19 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe | |||
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe | |||
rm -rf out/windows_tmp | |||
|
|||
out/docker-machine-driver-hyperkit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a
HYPERKIT_FILES := $(shell go list -f '{{join .Deps "\n"}}' k8s.io/minikube/cmd/drivers/hyperkit | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}')
and make this rule depend on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
hack/jenkins/common.sh
Outdated
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH} out/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox.yaml testdata/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/pvc.yaml testdata/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox-mount-test.yaml testdata/ | ||
|
||
# Add the out/ directory to the PATH, for using new drivers. | ||
export PATH=$PATH:"$(pwd)/out/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reverse the order of these two, so $(pwd)/out/ always takes precedence.
export PATH="$(pwd)/out/":$PATH
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
file.Close() | ||
|
||
if err := os.Truncate(diskPath, int64(diskSize*1048576)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diskSize * 10^6 instead of diskSize * 2^20. This code will give you diskSize * MiB instead of disksize * MB
I tried this out with
package main
import "os"
func main() {
os.Create("./test")
os.Truncate("./test", 1*1048576)
}
$ ls -l --block-size=KB
total 5kB
-rw-r----- 1 mrick eng 1kB Aug 22 13:16 main.go
-rw-r----- 1 mrick eng 1049kB Aug 22 13:16 test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
"github.com/docker/machine/libmachine/mcnutils" | ||
) | ||
|
||
func createDiskImage(sshKeyPath, diskPath string, diskSize int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment that says diskSize is in MB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
diskPath := filepath.Join(tmpdir, "disk") | ||
|
||
sizeInMb := 100 | ||
sizeInBytes := int64(sizeInMb) * 1048576 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
pkg/minikube/drivers/hyperkit/iso.go
Outdated
|
||
func findFile(r *iso9660.Reader, path string) (os.FileInfo, error) { | ||
for f, err := r.Next(); err != io.EOF; f, err = r.Next() { | ||
// Some files get an extra ',' at the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this function a little more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lease=0x597e1267 | ||
}`) | ||
|
||
func Test_getIpAddressFromFile(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to add a test with multiple entries with the same name but different MACs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a third entry. The code looks by MAC, so I can't really add a test for that case since name isn't part of the API at all.
@minikube-bot retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Excited to use this.
This looks fine - since its working properly, but worth it to note in the build logs:
|
hack/jenkins/common.sh
Outdated
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH} out/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox.yaml testdata/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/pvc.yaml testdata/ | ||
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox-mount-test.yaml testdata/ | ||
|
||
# Add the out/ directory to the PATH, for using new drivers. | ||
export "$(pwd)/out/":PATH=$PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export PATH="$(pwd)/out/":$PATH
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ export /home/jenkins/workspace/Linux_Integration_Tests_KVM/out/:PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/home/jenkins/go/bin:/usr/local/bin:/usr/local/go/bin:/home/jenkins/google-cloud-sdk/bin:/usr/local/bin:/usr/local/go/bin:/home/jenkins/google-cloud-sdk/bin
common.sh: line 37: export: `/home/jenkins/workspace/Linux_Integration_Tests_KVM/out/:PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/home/jenkins/go/bin:/usr/local/bin:/usr/local/go/bin:/home/jenkins/google-cloud-sdk/bin:/usr/local/bin:/usr/local/go/bin:/home/jenkins/google-cloud-sdk/bin': not a valid identifier
Build step 'Execute shell' marked build as failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
facepalm
REf #1543
cc @zchee
This is an implementation of a hyperkit driver, in-tree. It still runs as a separate executable/process that needs to be installed on your path somewhere as 'docker-machine-driver-hyperkit' because it needs setuid permissions.
It uses the native hyperkit.go wrapper and vmnet for networking.