Commit Graph

24 Commits

Author SHA1 Message Date
Maciej Szulik e4ccb76c1a kubectl: expose context parameter in DefaultRemoteExecutor
Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: 78e58b8c49fdcddba8cf939e5327440791c73a91
2025-03-12 15:51:13 +01:00
Abhishek Kr Srivastav 36d480f43c Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>

Kubernetes-commit: 95860cff1c418ea6f5494e4a6168e7acd1c390ec
2024-09-12 18:15:22 +05:30
Sean Sullivan 2c588bc5ed Falls back to SPDY for gorilla/websocket https proxy error
Kubernetes-commit: 9d560540c5268e0e2aebf5306907494cf522c260
2024-07-19 12:04:41 -07:00
Arda Güçlü d5a8f05803 Remove deprecated kubectl exec command execution without dash (#125437)
* Remove deprecated kubectl exec command execution without dash

* Use command execution with dash in kubectl exec

* Modify unit tests to only use command after dash

Kubernetes-commit: 6f4e97e905e5553e75a5a8c042c9f5a29bd1b78d
2024-06-21 19:22:55 +03:00
Sean Sullivan 2b8ea3563c remote command turn on feature gates
Kubernetes-commit: a147693deb2e7f040cf367aae4a7ae5d1cb3e7aa
2024-02-13 14:10:40 -08:00
Sean Sullivan 969a47ceed StreamTranslator and FallbackExecutor for WebSockets
Kubernetes-commit: 168998e87bfd49a1b0bc6402761fafd5ace3bb3b
2023-07-06 21:22:07 -07:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Arda Güçlü 7eb74e036f kubectl exec: return descriptive error message when multi resource passed
`kubectl exec` command supports getting files as inputs. However,
if the file contains multiple resources, it returns unclear error message;
`cannot attach to *v1.List: selector for *v1.List not implemented`.

Since `exec` command does not support multi resources, this PR
handles that and returns descriptive error message earlier.

Kubernetes-commit: 832644f0b38d536be7a5adce9bc62b0902710091
2022-12-02 14:05:11 +03:00
arkbriar d17f0318cc Support cancelable SPDY executor stream
Mark remotecommand.Executor as deprecated and related modifications.

Handle crash when streamer.stream panics

Add a test to verify if stream is closed after connection being closed

Remove blank line and update waiting time to 1s to avoid test flakes in CI.

Refine the tests of StreamExecutor according to comments.

Remove the comment of context controlling the negotiation progress and misc.

Signed-off-by: arkbriar <arkbriar@gmail.com>

Kubernetes-commit: 42808c8343671e6783ba4c901dcd619bed648c3d
2022-08-24 10:21:35 +08: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
mengjiao.liu a0af655b7a kubectl default container behavior
Kubernetes-commit: 88e530117ff3fff29e670aee51c677a8e0fe8dec
2021-03-05 17:04:40 +08:00
Clayton Coleman 56434236a4 kubectl: Inline the containers for the user in attach/exec
The behavior of the container defaulting in attach/exec is inconsistent
and should be unified. As a user, when we default the vast majority of
pods will have a small number of containers and so printing the container
names inline (as kubectl logs did) is more appropriate. The debug message
we printed about using describe was already longer than 99% of all pod
container names, so we were wasting user time.

Unify container selection for exec and attach to be consistent with old
behavior. Properly handle the --quiet flag (should not print in that case)
for both commands. Remove EnableCmdSuggestion and the machinery it needs.

The message now prints:

> Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-ensure-env-vars (init), etcd-resources-copy (init)

Kubernetes-commit: 43e8ebbbcd3f57d18d8151efb6242f88a763b06d
2021-02-11 11:40:25 -05:00
Clayton Coleman 46f90dca38 kubectl: Properly respect --quiet in exec/attach
--quiet means no informational output for the human that could be
confused with the output of the shell / command on the other side.

Kubernetes-commit: 75700d32bff0e28c7093ef384de78dbdd0db61b2
2021-02-11 11:48:43 -05:00
pacoxu 360e8d2b15 feature: use default container annotation for logs and exec
- update according to KEP: move getContainerName to helper

Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: b54e823dbce08bff6fab979243663b0fea5a351f
2020-12-07 15:30:30 +08:00
Karl 'NaN' Wikström 38408eaa8c cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals

cleanup: sort imports

Add i18n dependency for wait.go

Remove translation on envResource

cleanup: translate string instead of variable

cleanup: sort imports

cleanup: translate string literal only

Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
2020-10-09 13:16:13 +02:00
Morten Hauberg 84b55fb518 Remove double `kubectl` from output
Kubernetes-commit: 5fe57c61482611361502544f36e9df3d17898449
2020-04-07 12:54:26 +02:00
Davanum Srinivas 196f0c117a Move k8s.io/apiserver/pkg/util/term to k8s.io/component-base/term
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1d057da2f73118893b5cc27c15d59ff03beb271e
2020-03-16 16:27:44 -04:00
Maciej Szulik ed686e3fbe Wire --filename flag to exec
Kubernetes-commit: 9dac1699bfdb0ff2b8bcfd76c42815b033b3cce0
2020-02-24 14:35:37 +01:00
Mike Danese 71d8052cb0 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00