-
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
Fix minikube start
in order to be able to start VM even if machine does not exist
#5730
Conversation
Hi @govargo. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can one of the admins verify this patch? |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: govargo The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @sharifelgamal |
@minikube-bot OK to test |
@govargo that is a good improvement ! I was always annoyed by ctrl+c destroying things. thank you for working on this |
Codecov Report
@@ Coverage Diff @@
## master #5730 +/- ##
==========================================
- Coverage 38.1% 38.02% -0.08%
==========================================
Files 137 137
Lines 8690 8751 +61
==========================================
+ Hits 3311 3328 +17
- Misses 4963 5007 +44
Partials 416 416
|
/retest this please |
/ok-to-test |
/ok-to-test |
Old binary: [187.551600129 178.817823191 186.470780925] |
pkg/minikube/cluster/cluster.go
Outdated
@@ -112,6 +113,18 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error) | |||
s, err := h.Driver.GetState() | |||
glog.Infoln("Machine state: ", s) | |||
if err != nil { | |||
// If VirtualBox Machine does not exist due to user interrupt cancel(i.e. Ctrl + C), recreate VirtualBox Machine | |||
if driver.BareMetal(config.VMDriver) || config.VMDriver == driver.VirtualBox { |
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 please remind me why we need this check for none driver ?
driver.BareMetal(config.VMDriver)
?
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.
Thanks for your point out.
I thought that Mock driver judgement is needed and driver.BareMetal
is its method.
But I misunderstood.
I modified this driver.BareMetal
→ config.VMDriver == driver.Mock
.
the tests failures are not related to this PR |
@govargo sorry for the delay in the PR review, I left one comment. |
Thanks for your review. I merged v1.5.2 codebase into this branch. In v1.5.2, func startMachine has minikube/cmd/minikube/cmd/start.go Line 337 in a583cbe
minikube/cmd/minikube/cmd/start.go Lines 1181 to 1186 in a583cbe
I changed the following code to avoid skipping pulling necessary images. |
Old binary: [192.644036866 200.378705655 178.628237978] |
Updated code to resolve conflict(latest codebase edited the same file) |
Error: building minikube at head: updating minikube master branch: running [git pull origin master] in /home/performance-monitor/minikube: |
/retest this please |
I rebased for the latest codebase. |
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 is truely a great PR ! I just have one request change, to make an Error type called ErrMachineNotFound which is kndown to all drivers and all drivers return that if machine doesnt exist, so our test case code doesnt have to rely on virtuablox
@medyagh |
I investigated that where the drivers(& registries) return machine status. I think that I will make check function which check MachineDoesNotExist in somewhere file. In the check function, it will absorb the difference of all drivers error(hyperkit, kvm2, hyperv...). I think I have to check the all driver's MachineDoesNotExist Error case. |
@medyagh I use |
pkg/minikube/cluster/cluster.go
Outdated
|
||
// isMachineExists checks if virtual machine does not exist | ||
// if the virtual machine exists, return true | ||
func isMachineExists(vmDriver string, s state.State, err error) (bool, 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.
english nit: change this to, MachineExists , or DoesMachineExists. (shorter better)
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.
renamed to machineExists func
pkg/minikube/cluster/cluster.go
Outdated
return false, ErrorMachineNotExist | ||
} | ||
return true, err | ||
case driver.Mock: |
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 case dor kic driver (Docker)
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 kic(docker) case
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 other case for kic.
I noticed kic return other behavior depending on whether the kic image is pulled or not.
All Times minikube: [ 99.347414 94.832747 98.741138] Average minikube: 97.640433 Averages Time Per Log
|
All Times minikube: [ 96.461382 97.864359 96.592991] Average minikube: 96.972911 Averages Time Per Log
|
Do you mind fixing the merge conflict? Otherwise this PR appears to be ready to merge. |
@tstromberg |
All Times minikube: [ 98.037351 95.849441 94.035101] Average minikube: 95.973965 Averages Time Per Log
|
the integreation test failures are all time out waiting for a pod doesnt seem to be related to this PR |
@govargo thank you very much for this PR ! and your persistence to fix all the code review comments. |
…does not exist (kubernetes#5730) * fix startHost in order to be able to start VM even if machine does not exist * Update func StartHost() and its unit test no to use config.GetMachineName() * Add handle case when the kic image isn't pulled
What type of PR is this?
/kind bug
What this PR does / why we need it:
When minikube machine does not exist, the Virtual Machine fails starting.
If the host config exists but machine does not exist, we should start recreate VM automatically.
This PR fixes out of control error.
Which issue(s) this PR fixes:
Fixes #5509
Does this PR introduce a user-facing change?
Yes.
This PR fixes bug in order to
minikube start
command work successfully even if machine does not exist.Before this PR,
minikube start
command fails, when machine does not existAfter this PR,
minikube start
command success, even if machine does not existAdditional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: