Commit Graph

21 Commits

Author SHA1 Message Date
Sean Sullivan 13611d4701 Graduate PortForwardWebsockets to Beta
Kubernetes-commit: 3ae3b4ea551443d8ef695d31bf0c51963fe35ac3
2024-06-15 16:09:23 -07:00
TessaIO 5f33246cf8 feat: add ports autocompletion for kubectl port-forward command
Signed-off-by: TessaIO <ahmedgrati1999@gmail.com>

Kubernetes-commit: a84e893afa2d4fdd1e42ee6047812ff46daa9296
2024-05-01 23:33:39 +02:00
Sean Sullivan 18888dae3e adds comments to tunnelingResponseWriter
Kubernetes-commit: 3d56ff21fd3c9c9da82ff22044691ef0671ac7b6
2024-03-04 11:10:17 -08:00
Sean Sullivan 1ac3b7558a adds return context in RunPortForward()
Kubernetes-commit: 9e1546284302c66fda0bae12fc301ee8acf39933
2024-03-01 21:10:32 -08:00
Sean Sullivan 858d3a5b72 portforward: tunnel spdy through websockets
Kubernetes-commit: 8b447d8c97e8823b4308eb91cf7d75693e867c61
2024-02-21 08:56:07 +00:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Marc Khouzam cd5b039b42 Refactor completion code into its own package
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c4f8c57b43843abd13bae677b73c622e1c30b46f
2022-03-24 09:06:05 -04:00
Marc Khouzam cd245d2e22 Support completion for the <type>/<name> form
This commit teaches the shell completion logic how to handle the
<type>/<name> form for resource specification.

It also teaches the 'exec' command how to complete its '--container/-c'
flag using container names.

Also, for commands that work on pods, kubectl will now also suggest
completion choices of the form <type>/<name> for resource types that
contain pods (see below for more details).

The following commands can now have completion of the <type>/<name>
form. Commands that accept any resource type:

annotate
apply edit-last-applied
apply view-last-applied
delete
describe
edit
get
label
patch

Commands that accept a subset of resource types:

autoscale
expose
rollout history
rollout pause
rollout restart
rollout resume
rollout status
rollout undo
scale
taint

Commands that apply to resource types that contain pods:

attach
exec
logs
port-foward

For these last four commands, the possible resource types are now
included in the completion choices.  For example:
    kubectl exec d<TAB>
will suggest
    daemonsets/   deployments/

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: cf66f5c3cbd0a0e2f223af438ee4c6bc7e4a907c
2022-03-01 10:45:59 -05:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Marc Khouzam 5c679b006e Join common functions for completion
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 9625872d1e4fd0d4d397b3ab732c6969a3a376fe
2021-05-15 21:22:42 -04:00
Marc Khouzam 1946af5761 Move all completion bash code to Go code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 879cdc5fa9e518ce76b9e1dc7e795132457966f3
2021-03-05 15:43:31 -05:00
Huy Pham 274bb14190 doc: remove the description `socat` is required
This is no longer true as of `containerd` v1.4.0 because [0] removes `socat` dependency for port-forwarding. For lower versions of `containerd`, the error message is descriptive i.e. `"socat": executable file not found in $PATH`.

[0] https://github.com/containerd/cri/pull/1470

Kubernetes-commit: 64fca6bda7d36b9cc1667aa317896b540d4dcf8c
2021-03-30 09:56:23 -07:00
xiongzhongliang 7222c38716 code cleanup for kubectl port-forward
code cleanup for kubectl port-forward

code cleanup for kubectl port-forward

Kubernetes-commit: 555fa97cda1f24631642698e31c2b7b55c003cca
2020-12-27 00:49:18 +08:00
Christopher Montoro 74d55cc94b Update the example for kubectl port-forward
Clarify that `REMOTE_PORT` is interpreted as identifying a _Service_ port when provided `TYPE` is `service`.
Also, highlight support for specifying a named port as `REMOTE_PORT`.

Kubernetes-commit: 68e8fd5f33647f22a1bd9ff8508003a969036e25
2020-10-07 21:37:03 -04:00
Adrian Moreno 3de8ce8105 portforward: Fix UDP-only ports calculation
If a service has both TCP and UDP but the TCP port appears before in the
range loop, it will be considered a UDP-only port and the forwarding
will fail.

Fix that by calculating the difference between UDP ports and TCP ports.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>

Kubernetes-commit: 21b598cbe752dc5d2a2bca0e46729c9e72d162a3
2020-09-11 19:50:11 +02:00
knight42 5ee889da0a feat(port-forward): warn users about UDP port
Signed-off-by: knight42 <anonymousknight96@gmail.com>

Kubernetes-commit: ca8da7e2984a92a9c024f8f0e6cac2b9ae87339b
2020-06-01 12:28:01 +08:00
Jordan Liggitt 53a6dfe9f1 Simplify dual or single port logic
Kubernetes-commit: dfeb617cc0e6a7b4c595eb5f7e927e9ceec1e18d
2020-03-23 22:04:14 -04:00
Marius Ziemke a45347152c fix kubectl port-forward for services with explicit local port
Kubernetes-commit: ef2eaa4f8f7ce85478310775a134047a77a8e310
2020-03-08 17:49:18 +01:00
Mike Danese 71d8052cb0 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Naoki Oketani fe07b19cb4 Fix a bug in port-forward: named port not working with service
Kubernetes-commit: 73c1ab71e27eee0066ba637575e60093952f3ff1
2019-11-22 02:59:26 +09:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00