-
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
Cleanup ssh tunnels on cancel #10775
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Hi @m-lima. 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: m-lima 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 |
This PR is the same as the closed #10753 |
Can one of the admins verify this patch? |
Can someone help me with the CLA? I have tried |
@m-lima $ git config user.name are they same as the one that u used in the CLA signing ? |
Note that the |
/check-cla |
Updated the author name from "Marcelo Lima" to "m-lima". Still can't validate CLA |
@m-lima c maybe try to recreate the PR with the new git config ? |
does the email say marcelo wind at gmail (with word at? instead of @ ?) that could be the problem |
@m-lima would u like to close this PR and reopen again when CLA is fixed? |
/check-cla |
I can do that. I just don't know what to do to fix the CLA, though. This is why I was asking for help. I tried everything I could think of and everything suggested so far :( |
Details
In pkg/minikube/tunnel/kic/ssh_tunnel.go the interrupt signal is caught and it stops the LoadBalancerEmulator. However, it assumes that the interrupt will also propagate to the children ssh tunnels, which are running in a goroutine inside
startConnections
.The interrupt, however, kills the goroutine and the blocking call which waits for the child process to finish. This leaves the ssh tunnels dangling.
On the other hand, if
CTRL + C
is sent on the same terminal asminikube tunnel
and the clean-up routine included killing all ssh tunnels, the OS would error with "process already finished".This leads to accumulation of processes and is likely to happen. Since
minikube tunnel
is a blocking command, users will tend to detach it from the terminal and kill it with aSIGINT
(as proposed in #3647).Approaches
There are two proposed approaches. This PR takes the approach of having the tunnel know if is running or not. The second approach is to have the parent of all connections managed and know which processes should be killed.
The first approach, proposed with this PR, also addresses #8511, by letting the process owner hold the knowledge if the process is running or not. Since the ssh tunnels are started inside
startAndWait()
on pkg/minikube/tunnel/kic/ssh_conn.go, and a blocking call toWait()
is made, the owner can know when the process is started, finished, or killed.The second approach is more oriented towards the cleaning up of the ssh tunnels, and isolates changes to only pkg/minikube/tunnel/kic/ssh_tunnel.go. However it relies on
sync
. The second approach can be seen here: https://github.com/m-lima/minikube/tree/issue/10752-managed-killOutput
With this PR, users will be notified of connections being closed (as opposed to the silent death that happens now). E.g:
Also, when detaching from the terminal, all ssh tunnels will be reaped, also outputting to the terminal (if not redirected by the user). E.g:
On another terminal:
Main terminal:
fixes #10752