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

Bring KVM driver in-tree #1828

Merged
merged 3 commits into from
Aug 30, 2017
Merged

Bring KVM driver in-tree #1828

merged 3 commits into from
Aug 30, 2017

Conversation

r2d4
Copy link
Contributor

@r2d4 r2d4 commented Aug 16, 2017

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 16, 2017
@codecov-io
Copy link

codecov-io commented Aug 16, 2017

Codecov Report

Merging #1828 into master will increase coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
pkg/minikube/cluster/cluster.go 40.73% <0%> (ø) ⬆️
cmd/minikube/cmd/start.go 10.3% <0%> (+0.2%) ⬆️
pkg/util/utils.go 42.96% <0%> (-2.12%) ⬇️
pkg/util/kubeconfig/config.go 47.61% <0%> (+0.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c9603a...531e811. Read the comment docs.

@@ -0,0 +1,124 @@
/*
Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sgtm.

@r2d4 r2d4 force-pushed the in-tree-kvm branch 7 times, most recently from 2f4eddf to 76edd14 Compare August 22, 2017 22:32
@r2d4 r2d4 requested a review from dlorenc August 22, 2017 23:28
@r2d4
Copy link
Contributor Author

r2d4 commented Aug 22, 2017

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.

Copy link
Contributor

@dlorenc dlorenc left a 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 @@
/*
Copy link
Contributor

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 @@
/*
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

func getConnection() (*libvirt.Connect, error) {
conn, err := libvirt.NewConnect(qemusystem)
if err != nil {
return nil, errors.Wrap(err, "Error connecting to libvirt socket")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

func (d *Driver) createDomain() (*libvirt.Domain, error) {
tmpl := template.Must(template.New("domain").Parse(domainTmpl))
var domainXml bytes.Buffer
err := tmpl.Execute(&domainXml, d)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collapse if statement?

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@aaron-prindle aaron-prindle Aug 24, 2017

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
Copy link
Contributor

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?

Copy link
Contributor Author

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

return "", nil
}

for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this retry forever?

Copy link
Contributor Author

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.

return state.None, errors.Wrap(err, "getting domain state")
}

stateMap := map[libvirt.DomainState]state.State{
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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

}

log.Info("Waiting to get IP...")
time.Sleep(5 * time.Second)
Copy link
Contributor

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?

Copy link
Contributor Author

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.


var statusEntries []StatusEntry

err = json.Unmarshal(statuses, &statusEntries)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err is ignored?

Copy link
Contributor Author

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple cases per line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 28, 2017
@r2d4
Copy link
Contributor Author

r2d4 commented Aug 28, 2017

@dlorenc @aaron-prindle rebased and addressed comments, renaming to kvm2. PTAL

@aaron-prindle
Copy link
Contributor

You might want to update:
https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm-driver
with some information about this driver.

@r2d4 r2d4 merged commit 81f12ca into kubernetes:master Aug 30, 2017
@r2d4 r2d4 deleted the in-tree-kvm branch August 30, 2017 17:46
@BrendanBall
Copy link

BrendanBall commented Sep 9, 2017

can someone please explain what this means in terms of the docker machine kvm driver?

@r2d4
Copy link
Contributor Author

r2d4 commented Sep 9, 2017

It just means that you can build a custom kvm driver make install-kvm from this repo, for use with minikube using --vm-driver=kvm2

@warmchang
Copy link
Contributor

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?

@r2d4
Copy link
Contributor Author

r2d4 commented Sep 11, 2017

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

@warmchang
Copy link
Contributor

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):

1.Install the KVM binary as follows (e.g. CentOS):
$ sudo curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-centos7 -o /usr/local/bin/docker-machine-driver-kvm

2. Make the binary executable:
$ sudo chmod +x /usr/local/bin/docker-machine-driver-kvm

For more information, see the documentation of the link: [docker machine KVM driver](https://github.com/dhiltgen/docker-machine-kvm#quick-start-instructions)

@r2d4
Copy link
Contributor Author

r2d4 commented Sep 12, 2017

Yeah, I'll add some documentation today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ready-for-review size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants