-
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
Ensure only one instance of tunnel process runs #15834
Conversation
Hi @OmSaran. 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? |
cmd/minikube/cmd/tunnel.go
Outdated
if os.IsNotExist(err) { | ||
_, err = os.Create(tunnelLockPath) | ||
if err != nil { | ||
exit.Error(reason.SvcTunnelStart, fmt.Sprintf("error creating lock for tunnel file (%s)", tunnelLockPath), err) |
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.
Lets create a new reason in reason package and we can call it
TUNNEL_ALREADY_RUNNING
also make sure the exit message does not have github box since this is not a crash or issue. This is a usage problem.
look at minikube profile list code, when there is no cluster running it exits nicely (no need to show github issue box and crying emoji)
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've added the new reason as proposed.
- Fixed the github box, however I've made this change only when we fail to acquire filelock (line 152). If there are errors in creating the file itself or creating the lock handle itself, then I have left it as is (with github box). Let me know if this is not the correct thing to do.
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.
Consider adding an integration test.
in functional test we already have a test that runs minikube tunnel, we could add a new test and run tunnel second time and expect it to fail on second time with exact error type
@medyagh I've added the integration test as well. Would be great if you could take a look! |
ef2a630
to
40b1bb5
Compare
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.
hi @OmSaran I requested a couple changes, but over all looks good
I can think of 2 ways of debugging this:
What do you think I should do? Or is there a better way to debug this? (Note that for 1. I'll need access to a windows machine which I don't have) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
What do you think I should do? Or is there a better way to debug this? (Note that for 1. I'll need access to a windows machine which I don't have)
@OmSaran I ran it on Windows and found the issue. Window is finicky about open files, so you're creating the lock file with os.Create
but not closing the file, on Windows you can't interact with a file if it's open in another process. So when you call fslock.New(tunnelLockPath)
& lockHandle.TryLock()
it throws an error as os.Create
is the active one using it. I would have recommended you close the file after creating it, but I don't think all this open and creation code is needed as I believe fslock.New
will handle creating the file for us. We have other cases of using fslock.New
and we don't create the file ahead of time. I also tried removing all the file creation code and the file still existed for me after running the tunnel command.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 good, just one last thing, can you run make generate-docs
to update the translations and test list, thanks!
Done, thank you for your patience and guidance! |
kvm2 driver with docker runtime
Times for minikube start: 53.6s 50.4s 52.5s 55.4s 52.3s Times for minikube ingress: 26.9s 28.8s 28.8s 29.8s 28.8s docker driver with docker runtime
Times for minikube start: 25.1s 25.0s 24.6s 24.6s 24.9s Times for minikube ingress: 21.1s 51.1s 21.7s 21.1s 22.1s docker driver with containerd runtime
Times for minikube (PR 15834) ingress: 19.6s 47.6s 32.6s 32.7s 47.6s Times for minikube start: 23.3s 22.8s 23.7s 23.5s 22.4s |
These are the flake rates of all failed tests.
To see the flake rates of all tests by environment, click 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.
Thanks for persisting through this PR and helping add this feature!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: OmSaran, spowelljr 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 |
What if I have multiple profiles with multi-node clusters? |
There's no way to specify which node to use with |
Thanks!! Yes, that's what I was intending to say - multi profile... I said "multi node" bec that's the multiple profiles is introduced (AFAIK) in docs at https://minikube.sigs.k8s.io/docs/tutorials/multi_node/ |
Just to clarify, multiple profiles and multi-node are two different things. You can start independent clusters with completely different configurations using the Example:
The link you posted is multi-node, which is adding worker nodes to a profile. Example:
Hope that clears it up |
Understood... my usual practice is to have one profile per project.... but have multi nodes w/in the profile bec testing rack awareness is usually on the list.... So when I have 2 projects going (or sometimes even 3!), would love to be able to have 2 tunnels going. |
For sure, that was an oversight by me when reviewing the PR, thanks for catching it before the release! Here's the PR #16839 |
fixes #15825
Both outputs are for the second invocation
Before:
After:
If cluster is not running, this is the behavior:
Cluster status:
Behavior: