-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
ability to run a local command with port-forward #97592
Conversation
@carlory: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Hi @carlory. 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: carlory 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 |
26159f6
to
46802fe
Compare
Example: ➜ kubernetes git:(feature-kubectl-port-forward) ✗ _output/bin/kubectl port-forward backend-mysql-55c8958756-b6sh2 3306 -- mysql -h 127.0.0.1 -uroot -p
Forwarding from 127.0.0.1:3306 -> 3306
Forwarding from [::1]:3306 -> 3306
Enter password:
Handling connection for 3306
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.21 sec)
mysql> exit
Bye |
46802fe
to
487c5cd
Compare
/assign @deads2k @FranciscoKurpiel |
@carlory: GitHub didn't allow me to assign the following users: FranciscoKurpiel. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
Thanks for your guide. It is a good idea. I will try to implement it this week. |
487c5cd
to
31bbd51
Compare
@FranciscoKurpiel suppress case 1: ➜ kubernetes git:(feature-kubectl-port-forward) ./_output/bin/kubectl port-forward -q backend-mysql-55c8958756-b6sh2 3306 -- mysql -h 127.0.0.1 -uroot -pdangerous -e "select version();"
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------+
| version() |
+-----------+
| 5.7.22 |
+-----------+ case 2: ➜ kubernetes git:(feature-kubectl-port-forward) ./_output/bin/kubectl port-forward -q backend-mysql-55c8958756-b6sh2 3306 -- mysql -h 127.0.0.1 -uroot -pdangerous -e "select version();" > /tmp/out.log 2> /tmp/err.log
➜ kubernetes git:(feature-kubectl-port-forward) cat /tmp/out.log
version()
5.7.22
➜ kubernetes git:(feature-kubectl-port-forward) cat /tmp/err.log
mysql: [Warning] Using a password on the command line interface can be insecure. case 3: ➜ kubernetes git:(feature-kubectl-port-forward) ./_output/bin/kubectl port-forward -q backend-mysql-55c8958756-b6sh2 3306 -- mysql -h 127.0.0.1 -uroot -pdangerous -e "select version();" 2> /tmp/err.log | grep -v "version"
5.7.22
➜ kubernetes git:(feature-kubectl-port-forward) ./_output/bin/kubectl port-forward -q backend-mysql-55c8958756-b6sh2 3306 -- mysql -h 127.0.0.1 -uroot -pdangerous -e "select version();" | grep -v "version"
mysql: [Warning] Using a password on the command line interface can be insecure.
5.7.22 |
There is still a problem to be considered here. If during the execution of the local command, the goroutine responsible for forwarding the network traffic exits suddenly, immediately returns the error of the goroutine, and exit the executing command, is it really reasonable? go func() {
errChan <- o.PortForwarder.ForwardPorts("POST", req.URL(), o)
}() It may be a good idea to only print the port-forwarder error to @FranciscoKurpiel Any ideas about it? |
That should be handled a broken pipe, we should send a I'm just a bit worried with the fact that we are moving quite a lot before the ticket being accepted or discussed on the sig. I provided the ticket and I'm providing my input, but the actual specification will come from the special group. |
/ok-to-test |
@carlory: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/ok-to-test |
/test pull-kubernetes-bazel-test |
/retest |
@carlory: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This would allow scripting around port-forwarding. That will be especially useful for developers, but can also be useful in production. Currently, we can do that, but we have to use one terminal to create the port-forwarding, use another to run any tool that uses the port, then finally go back to the first terminal and terminate the forwarding. This is not scriptable.
Which issue(s) this PR fixes:
Fixes #97549
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: