-
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
Bring KVM driver in-tree #1828
Bring KVM driver in-tree #1828
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1828 +/- ##
==========================================
+ Coverage 32.23% 32.26% +0.02%
==========================================
Files 69 69
Lines 4104 4104
==========================================
+ Hits 1323 1324 +1
+ Misses 2608 2607 -1
Partials 173 173
Continue to review full report at Codecov.
|
@@ -0,0 +1,124 @@ | |||
/* |
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.
@dlorenc @aaron-prindle Where should the in-tree drivers live? I just used the location that @dlorenc had in his hyperkit PR. We have the none driver in pkg/minikube/machine/drivers/none
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.
This sgtm.
2f4eddf
to
76edd14
Compare
I think this is ready to go @dlorenc. I think theres a little overlap in the hack/ changes between our driver PRs, so if you want to wait until you merge yours, I'll fix this up afterwards. |
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 pretty good. Made a first pass.
@@ -0,0 +1,124 @@ | |||
/* |
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.
This sgtm.
@@ -0,0 +1,26 @@ | |||
/* |
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.
Could you add a build tag here to restrict to linux?
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
pkg/drivers/kvm/domain.go
Outdated
func getConnection() (*libvirt.Connect, error) { | ||
conn, err := libvirt.NewConnect(qemusystem) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "Error connecting to libvirt socket") |
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.
We've had a bunch of bugs about users not understanding this or a similar error. Could we make this a bit more helpful, with some suggestions about how to resolve it?
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 our KVM driver doc to the help text and a link back to our docs.
pkg/drivers/kvm/domain.go
Outdated
func (d *Driver) createDomain() (*libvirt.Domain, error) { | ||
tmpl := template.Must(template.New("domain").Parse(domainTmpl)) | ||
var domainXml bytes.Buffer | ||
err := tmpl.Execute(&domainXml, d) |
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.
Collapse if statement?
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
Makefile
Outdated
@@ -257,3 +259,16 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile | |||
release-iso: minikube_iso checksum | |||
gsutil cp out/minikube.iso gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso | |||
gsutil cp out/minikube.iso.sha256 gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso.sha256 | |||
|
|||
out/docker-machine-driver-kvm: $(KVM_DRIVER_FILES) |
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 give this a different name so users can swap between the two for testing? kvm2?
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 think renaming might be a lot of work. We'd need to add it to the supported driver list in minikube, so it would show up for all users. I was planning to drop official support for the docker-machine-driver-kvm when we start bundling the in-tree one. There really should be no functionality difference between the two.
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.
From the meeting it seemed like renaming to 'minikube-kvm' or 'kvm2' is preferred to not break things.
} | ||
} | ||
|
||
//Not implemented yet |
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 think you can just delete these?
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 don't think so. They are part of the drivers.Driver interface
pkg/drivers/kvm/kvm.go
Outdated
return "", nil | ||
} | ||
|
||
for { |
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.
Will this retry forever?
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 dont think we actually need this block. Removed it.
pkg/drivers/kvm/kvm.go
Outdated
return state.None, errors.Wrap(err, "getting domain state") | ||
} | ||
|
||
stateMap := map[libvirt.DomainState]state.State{ |
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.
Make this a var initialized outside of here?
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.
Or a switch statement, which would let you avoid the ok check as well.
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.
changed it to a switch statement
pkg/drivers/kvm/kvm.go
Outdated
} | ||
|
||
log.Info("Waiting to get IP...") | ||
time.Sleep(5 * time.Second) |
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.
Why do we sleep here?
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.
no reason. probably a debug artifact. removed.
pkg/drivers/kvm/network.go
Outdated
|
||
var statusEntries []StatusEntry | ||
|
||
err = json.Unmarshal(statuses, &statusEntries) |
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.
err is ignored?
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.
checking it now. done
return state.None, errors.Wrap(err, "getting domain state") | ||
} | ||
|
||
switch libvirtState { |
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.
multiple cases per line
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
Add boilerplate Review feedback
@dlorenc @aaron-prindle rebased and addressed comments, renaming to kvm2. PTAL |
You might want to update: |
can someone please explain what this means in terms of the docker machine kvm driver? |
It just means that you can build a custom kvm driver |
Is this means that minikube no need the docker-machine-kvm (https://github.com/dhiltgen/docker-machine-kvm) anymore, and it can use kvm directly now? |
No, unfortunately the new driver is also a standalone binary. The in-tree just refers to the fact that we're going to be developing and releasing it from this two rather than keep development somewhere else. It does allow us to easily share a lot of the overlap between the hyperkit and kvm drivers though #1941 |
So it looks like we need to add some descriptions in the kvm-driver preparation (https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm-driver):
|
Yeah, I'll add some documentation today |
No description provided.