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

Error out if --vm-driver is incompatible with existing VM #5016

Merged
merged 1 commit into from
Sep 12, 2019

Conversation

RA489
Copy link

@RA489 RA489 commented Aug 8, 2019

Remove "Ignoring --vm-driver" warning.
fixes #4998

./out/minikube start --vm-driver=kvm2
😄  minikube v1.3.0 on Ubuntu 16.04
⚠️  Please don't run minikube as root or with 'sudo' privileges. It isn't necessary with kvm2 driver.


⚠️  The existing "minikube" VM was created using the kvm2 driver.
⚠️  To switch drivers, you may create a new VM using `minikube start -p <name> --vm-driver=kvm2`
⚠️  Alternatively, you may delete the existing VM using `minikube delete -p minikube`


🔄  Starting existing kvm2 VM for "minikube" ...
⌛  Waiting for the host to be provisioned ...
🐳  Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...
🔄  Relaunching Kubernetes using kubeadm ... 
⌛  Waiting for: apiserver proxy etcd scheduler controller dns
🏄  Done! kubectl is now configured to use "minikube"

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 8, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RA489

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 8, 2019
@RA489
Copy link
Author

RA489 commented Aug 8, 2019

/assign @RA489

@medyagh
Copy link
Member

medyagh commented Aug 8, 2019

Do you mind sharing the output of the minikube start Before and After this PR in the description ?

@RA489
Copy link
Author

RA489 commented Aug 9, 2019

@medyagh sure.

@RA489 RA489 changed the title WIP: Remove "Ignoring --vm-driver" warning Remove "Ignoring --vm-driver" warning Aug 9, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2019
@RA489
Copy link
Author

RA489 commented Aug 9, 2019

@medyagh The output of minikube start before was

./out/minikube start --vm-driver=kvm2
😄  minikube v1.3.0 on Ubuntu 16.04
⚠️  Please don't run minikube as root or with 'sudo' privileges. It isn't necessary with kvm2 driver.
⚠️  Error checking driver version: exec: "docker-machine-driver-kvm2": executable file not found in $PATH


⚠️  Ignoring --vm-driver=kvm2, as the existing "minikube" VM was created using the virtualbox driver.
⚠️  To switch drivers, you may create a new VM using `minikube start -p <name> --vm-driver=kvm2`
⚠️  Alternatively, you may delete the existing VM using `minikube delete -p minikube`


🏃  Using the running virtualbox "minikube" VM ...
⌛  Waiting for the host to be provisioned ...
🐳  Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...
🔄  Relaunching Kubernetes using kubeadm ... 
⌛  Waiting for: apiserver proxy etcd scheduler controller dns
🏄  Done! kubectl is now configured to use "minikube"

@RA489
Copy link
Author

RA489 commented Aug 9, 2019

@medyagh The output of minikube start After with none driver.

./out/minikube start --vm-driver=none
😄  minikube v1.3.0 on Ubuntu 16.04


⚠️  The existing "minikube" VM was created using the none driver.
⚠️  To switch drivers, you may create a new VM using `minikube start -p <name> --vm-driver=none`
⚠️  Alternatively, you may delete the existing VM using `minikube delete -p minikube`


🏃  Using the running none "minikube" VM ...
⌛  Waiting for the host to be provisioned ...
🐳  Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...
🔄  Relaunching Kubernetes using kubeadm ... 
⌛  Waiting for: apiserver proxy etcd scheduler controller dns
🏄  Done! kubectl is now configured to use "minikube"

@@ -104,8 +104,8 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)

if h.Driver.DriverName() != config.VMDriver {
out.T(out.Empty, "\n")
out.WarningT(`Ignoring --vm-driver={{.driver_name}}, as the existing "{{.profile_name}}" VM was created using the {{.driver_name2}} driver.`,
out.V{"driver_name": config.VMDriver, "profile_name": cfg.GetMachineName(), "driver_name2": h.Driver.DriverName()})
out.WarningT(`The existing "{{.profile_name}}" VM was created using the {{.driver_name}} driver.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the way you worded this.

The description in #4998 was not very clear, but to mirror my intent, could you change this PR to:

  • Omit all of these warnings if the driver flag was not set by the user: if !cmd.Flags().Changed(vmDriver)
  • If the driver flag was set, call exit.WithCode(exit.Config, "<this message>")

Copy link
Author

Choose a reason for hiding this comment

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

sure

Copy link
Author

Choose a reason for hiding this comment

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

@tstromberg PTAL.

Copy link
Contributor

@tstromberg tstromberg left a comment

Choose a reason for hiding this comment

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

Thank you for doing this!

@medyagh
Copy link
Member

medyagh commented Aug 14, 2019

/retest this please

@tstromberg tstromberg added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 14, 2019
@tstromberg
Copy link
Contributor

Anything I could help with to move this PR forwards?

@TravisBuddy
Copy link

Travis tests have failed

Hey @RA489,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

View build log

make test
which go-bindata || GO111MODULE=off GOBIN=/home/travis/gopath/bin go get github.com/jteeuwen/go-bindata/...
PATH="/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.12.9.linux.amd64/bin:/home/travis/bin:/home/travis/bin:/home/travis/.local/bin:/usr/local/lib/jvm/openjdk11/bin:/opt/pyenv/shims:/home/travis/.phpenv/shims:/home/travis/perl5/perlbrew/bin:/home/travis/.nvm/versions/node/v8.12.0/bin:/home/travis/.rvm/gems/ruby-2.5.3/bin:/home/travis/.rvm/gems/ruby-2.5.3@global/bin:/home/travis/.rvm/rubies/ruby-2.5.3/bin:/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.11.1.linux.amd64/bin:/usr/local/maven-3.6.0/bin:/usr/local/cmake-3.12.4/bin:/usr/local/clang-7.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/travis/.rvm/bin:/home/travis/.phpenv/bin:/opt/pyenv/bin:/home/travis/.yarn/bin:/home/travis/gopath/bin" go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
gofmt -s -w pkg/minikube/assets/assets.go
which go-bindata || GO111MODULE=off GOBIN=/home/travis/gopath/bin go get github.com/jteeuwen/go-bindata/...
/home/travis/gopath/bin/go-bindata
PATH="/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.12.9.linux.amd64/bin:/home/travis/bin:/home/travis/bin:/home/travis/.local/bin:/usr/local/lib/jvm/openjdk11/bin:/opt/pyenv/shims:/home/travis/.phpenv/shims:/home/travis/perl5/perlbrew/bin:/home/travis/.nvm/versions/node/v8.12.0/bin:/home/travis/.rvm/gems/ruby-2.5.3/bin:/home/travis/.rvm/gems/ruby-2.5.3@global/bin:/home/travis/.rvm/rubies/ruby-2.5.3/bin:/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.11.1.linux.amd64/bin:/usr/local/maven-3.6.0/bin:/usr/local/cmake-3.12.4/bin:/usr/local/clang-7.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/travis/.rvm/bin:/home/travis/.phpenv/bin:/opt/pyenv/bin:/home/travis/.yarn/bin:/home/travis/gopath/bin" go-bindata -nomemcopy -o pkg/minikube/translate/translations.go -pkg translate translations/...
gofmt -s -w pkg/minikube/translate/translations.go
./test.sh
= go mod ================================================================
ok
= make lint =============================================================
golangci/golangci-lint info checking GitHub for tag 'v1.17.1'
golangci/golangci-lint info found version: 1.17.1 for v1.17.1/linux/amd64
golangci/golangci-lint info installed out/linters/golangci-lint
pkg/minikube/cluster/cluster.go:107:8: WithCode not declared by package exit (typecheck)
		exit.WithCode(exit.Config, `The existing "{{.profile_name}}" VM was created using the {{.driver_name}} driver.`,
		     ^
Makefile:334: recipe for target 'lint-ci' failed
make[1]: *** [lint-ci] Error 1
= boilerplate ===========================================================
ok
= schema_check ==========================================================
ok
= go test ===============================================================
# k8s.io/minikube/pkg/minikube/cluster
pkg/minikube/cluster/cluster.go:107:3: undefined: exit.WithCode
FAIL	k8s.io/minikube/cmd/minikube/cmd [build failed]
FAIL	k8s.io/minikube/cmd/minikube/cmd/config [build failed]
ok  	k8s.io/minikube/pkg/drivers	0.015s	coverage: 19.6% of statements
# k8s.io/minikube/pkg/minikube/cluster [k8s.io/minikube/pkg/minikube/cluster.test]
pkg/minikube/cluster/cluster.go:107: undefined: exit.WithCode
ok  	k8s.io/minikube/pkg/drivers/kvm	0.046s	coverage: 2.3% of statements
ok  	k8s.io/minikube/pkg/minikube/assets	0.041s	coverage: 61.8% of statements
ok  	k8s.io/minikube/pkg/minikube/bootstrapper	2.414s	coverage: 72.9% of statements
FAIL	k8s.io/minikube/pkg/minikube/bootstrapper/kubeadm [build failed]
FAIL	k8s.io/minikube/pkg/minikube/cluster [build failed]
ok  	k8s.io/minikube/pkg/minikube/config	0.041s	coverage: 76.0% of statements
ok  	k8s.io/minikube/pkg/minikube/cruntime	0.016s	coverage: 62.4% of statements
ok  	k8s.io/minikube/pkg/minikube/extract	0.014s	coverage: 56.7% of statements
ok  	k8s.io/minikube/pkg/minikube/kubeconfig	0.065s	coverage: 75.6% of statements
ok  	k8s.io/minikube/pkg/minikube/logs	0.038s	coverage: 1.4% of statements
ok  	k8s.io/minikube/pkg/minikube/machine	0.053s	coverage: 11.3% of statements
ok  	k8s.io/minikube/pkg/minikube/notify	0.032s	coverage: 81.5% of statements
ok  	k8s.io/minikube/pkg/minikube/out	0.011s	coverage: 70.3% of statements
ok  	k8s.io/minikube/pkg/minikube/problem	0.005s	coverage: 42.9% of statements
ok  	k8s.io/minikube/pkg/minikube/proxy	0.024s	coverage: 100.0% of statements
ok  	k8s.io/minikube/pkg/minikube/registry	0.013s	coverage: 100.0% of statements
FAIL	k8s.io/minikube/pkg/minikube/service [build failed]
ok  	k8s.io/minikube/pkg/minikube/sshutil	0.322s	coverage: 75.0% of statements
ok  	k8s.io/minikube/pkg/minikube/translate	0.010s	coverage: 8.4% of statements
FAIL	k8s.io/minikube/pkg/minikube/tunnel [build failed]
ok  	k8s.io/minikube/pkg/util	1.193s	coverage: 61.6% of statements
ok  	k8s.io/minikube/pkg/util/lock	0.006s	coverage: 59.1% of statements
ok  	k8s.io/minikube/pkg/util/retry	0.007s	coverage: 0.0% of statements
Makefile:232: recipe for target 'test' failed
make: *** [test] Error 20
TravisBuddy Request Identifier: 0e9e92c0-d2ce-11e9-a210-7faf5261cf76

@tstromberg tstromberg merged commit 38123cd into kubernetes:master Sep 12, 2019
@tstromberg
Copy link
Contributor

Thank you!

@tstromberg tstromberg changed the title Remove "Ignoring --vm-driver" warning Error out if --vm-driver is incompatible with existing VM Sep 16, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove "Ignoring --vm-driver" warning
5 participants