Commit Graph

68 Commits

Author SHA1 Message Date
Jordan Liggitt 722397942b Drop null creationTimestamp from test fixtures
Kubernetes-commit: 6bb6c9934294d8265197c9dfc4c9dd3adaca147a
2025-03-24 09:37:26 -04:00
Arda Güçlü 608a0553d7 Use generic sets rather than deprecated sets.String
Kubernetes-commit: c3f15fd707a092e6cb7d96b84b81ada1f118d759
2024-11-21 13:22:39 +03:00
Anish Shah b22c40d47c kubectl: remove subresource restrictions from all commands
Removing this restrictions will allow us to use these commands with the
new resize subresource.

Kubernetes-commit: e1ca63489f2b788f893ab37a27242ce319e1eaf6
2024-10-31 16:00:52 -07: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
Ritikaa96 24a31a929b correcting description as per review
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: b9ec8b3c4643c36491ba94e48e6b957828c850cb
2024-05-30 11:53:02 +05:30
Ritikaa96 6c2c451048 adding suggested changes
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 6f4e60a6b7ce56a5e083330f2b8c2277f4a659f0
2024-02-26 11:05:01 +05:30
Ritikaa96 2f762a69a2 Improving kubectl get output
Adding namespace flag & examples
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 22186fafaf79d6eae8375b3d018e181a645a3d31
2024-02-22 14:56:45 +05:30
Brian Pursley 8d8b5a6120 Use ptr.To instead of deprecated pointer functions
Kubernetes-commit: 288d132cf62efe029b6359c600565f8c7b12647d
2024-05-20 16:14:54 -04:00
Eduard Voiculescu f8b298459c show warning message only when running kubectl get --watch-only
Kubernetes-commit: a0aa7bf6d18bbeccc48447bb859ffb8fe28da3dc
2024-02-29 13:53:11 -05:00
Brian Pursley 150571ea52 Change non-quantity strings to sort alphanumerically, instead of using "Natural Sort", which is confusing for users.
Kubernetes-commit: 322aa9a649de1db9f9a18889a3c249ec841d2127
2024-04-24 14:59:37 -04:00
weilaaa b84e274c59 use build-in max and min func to instead of k8s.io/utils/integer funcs
Kubernetes-commit: eb8f3f194fed16484162aebdaab69168e02f8cb4
2023-12-15 15:09:11 +08:00
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
Tim Hockin c131fb884e Replace uses of ObjectReflectDiff with cmp.Diff
ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: bc302fa4144d21a338683cd83701661f97be4aba
2023-03-23 11:34:03 -07:00
Tim Hockin a431fc3d05 Replace apimachinery diff.StringDiff with cmp
I forced failures of most of these tests and verified readability

Kubernetes-commit: 97bab44cae3857710bfb072d233e654784082ee3
2023-03-23 11:10:32 -07:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Brian Pursley a2ae001d8e cmd/get: Remove cmd argument from Run()
Removes the need to pass cmd as an argument to Run(). This change required reading the --sort-by flag in Complete() in a way similar to other flags.

This change allows the cobra.Command not to need to be passed throughout the completion code, which I updated as part of this commit.

It also is a step in the direction of the TODO comment requesting the removal of arguments passed to Run() and watch().

Kubernetes-commit: aa7a828f20b479a8a943d897224e8e76c3bb6cff
2022-12-23 14:56:59 -05:00
Sean Sullivan 072ad05626 Removes deprecated kubectl openapi column printing
Kubernetes-commit: 2f184814b89a4bfa482b8572e98e969681e2f64c
2023-01-10 15:30:04 -08:00
inosato 8272d71ba6 Remove ioutil from kubectl
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 774ab1349bfd553c97a99b992e9f38659f541c84
2022-07-30 22:31:16 +09:00
David Leadbeater 8e2918ab8b Escape terminal special characters in kubectl (#112553)
* Escape terminal special characters in kubectl

* Add escaping for kubectl alpha events

Kubernetes-commit: dad0e937c0f76344363eb691b2668490ffef8537
2022-10-30 16:29:24 +00:00
Oscar Utbult bfae23fc18 grammar: replace all occurrences of "the the" with "the"
Kubernetes-commit: e4f776f23098ecf942cafa898777195adbc800f1
2022-09-17 22:58:01 +02:00
Arda Güçlü 89edfadfa3 Use OpenAPI to determine patch type in kubectl apply patching
Currently `kubectl apply` determines correct patch type for given
GVKs by trying to register schema and if it succeeds, it uses
strategic-merge-patch.

But OpenAPI endpoint already stores which patch types are supported
by GVKs. This PR checks OpenAPI endpoint to retrieve patch type,
if OpenAPI is enabled. If it is not enabled, patch type determination
will be done as conventional registration method.

Kubernetes-commit: cddbb0c56397448ac0489f0473a26601c1feece8
2022-06-08 13:12:16 +03:00
Davanum Srinivas d3700ce217 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
xiaopeng bc02b7b600 add setErr
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>

Kubernetes-commit: 8839609868d4b2b5887eefdbb216c1ed5b848edc
2022-06-21 17:57:48 +08:00
xiaopeng a833054047 replace deprecated setoutput
Kubernetes-commit: 48629bcc0588773bc837d1cc69cab8b21a2057e0
2022-04-05 14:04:22 +08:00
21kyu 0bf778323e Change reflect.Ptr to reflect.Pointer
Kubernetes-commit: df168d5b5c2dab7414fc00ead1a51257ec326a98
2022-06-26 01:23:43 +09:00
Arda Güçlü 81a25f37b5 Set validate functions requiring no parameters for all commands
Validate function is used to validate command options and should not get
any additional parameter. To preserve compatibility across all
kubectl commands, this PR removes all parameters in validate functions.

Kubernetes-commit: 8fb423bfabe0d53934cc94c154c7da2dc3ce1332
2022-05-17 11:38:20 +03:00
xin.li 8207383170 update kubectl doc url
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: e89a87f708a03c5a8331639739982d426077ad3a
2022-05-05 21:27:52 +08:00
Ikko Ashimine be8cd595fc Fix typo in get_test.go
overide -> override

Kubernetes-commit: 10cdb0546aa7b89d8d6ab93d0826e4cda5c060eb
2021-12-13 22:56:22 +09: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
Yuvaraj Kakaraparthi 38487e770c kubectl: add --support to get, patch, edit and replace commands
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>

Kubernetes-commit: a5aa858d44651ba48bdce634a39b55be91216614
2021-07-07 08:30:59 -07:00
Chok Yip Lau 6a5a78c26b Beautify kubectl help flag commands
Kubernetes-commit: 1c031d4fa8450550fa9a6bd5abe7fac45816156e
2021-09-02 13:41:07 -04:00
kkkkun b5be321e1a sort custom column print flags
Kubernetes-commit: 36ed148761cb5a30c21b45a64d95cabd1a9d07ff
2022-03-03 22:31:58 +08:00
Wojciech Tyczyński 3f11f31017 Stop setting selfLink in kubectl
Kubernetes-commit: 9015f27e6d8295d7dcdbf5915024f28cc00d4d2f
2022-02-16 17:13:54 +01:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
卢振兴10069964 165827de9c code cleanup for kubectl
Kubernetes-commit: 17993020cdca7eea2fb96a993e048d2d0624fa40
2021-04-12 10:45:08 +08:00
Marc Khouzam b111bee570 Complete multiple resource names
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.

For example, the get command can receive multiple pods names, therefore
with this commit we have:
  kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.

The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint

Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.

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

Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
2021-10-15 15:36:09 -04:00
Marc Khouzam b9e380aef5 Add completion to the --output/-o flag
For example:
$ kubectl get -o json<TAB>
json   jsonpath   jsonpath-as-json  jsonpath-file

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

Kubernetes-commit: 5f22baeaf1f662d0fe90ea41e453883cb726323c
2021-10-22 15:15:23 -04:00
caozhiyuan 0cf1a18bec handle error when parse Quantity
Kubernetes-commit: b9d7584c3a838d83c6c8c6e405907bf05addc850
2021-09-18 15:05:21 +08:00
Di Xu f106a734e3 cleanup description on deprecated include-uninitialized flag
Kubernetes-commit: ae7b9787ee7b46bb83b05d3769ed54374c0337a7
2021-07-26 11:14:55 +08:00
novahe 95ce5a060b remove stack trace log when sorting with a bad unsortable field
Kubernetes-commit: abf735daa83f1d931614292664c2df1c6735aebb
2021-07-03 21:34:41 +08:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
caodonghui b709633a6c update url
Kubernetes-commit: a2c1b284da29ec07eaf6a0403d75cf9d881d45b8
2021-07-06 14:55:38 +08:00
Marc Khouzam 724356168b Revert "Add Go tests for custom completions"
This reverts commit 0e18f0380042b652996d795559bfb818698abec3.

Kubernetes-commit: 1babceac650cfe8ec7ac71b34ed1ecf118b50f9d
2021-05-22 20:47:14 -04:00
Marc Khouzam af40736fcc Add Go tests for custom completions
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c0b3a698fa15265eecdec0bd8776658c40d8d151
2021-03-05 15:44:30 -05: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
Chok Yip Lau 8a6f838eea Fixed sort-by not sorting Resources as expected
Kubernetes-commit: e43e9696cc69d835c98b5d590af702677675419a
2021-03-21 17:44:52 -04:00
Katrina Verey 086cadbf87 Create helper for adding chunk-size flag to commands
Kubernetes-commit: f8097c6ceeb16461861c74d4fc5dd0bcd36ebeaf
2021-03-19 08:30:49 -07:00
Katrina Verey 9348b0acca Extract DefaultChunkSize constant
Kubernetes-commit: 222e2c5ef897f4d47831b8d822cab09c000037c2
2021-03-10 12:21:25 -08:00
Hidetatsu Yaginuma ea99c2e0e8 use AllowedFormat in kubectl get help to avoid code duplication (#99983)
Kubernetes-commit: 0486f1a728c964f643c70d1f3aea59243a4fedf8
2021-04-09 09:10:22 +09:00