Commit Graph

6 Commits

Author SHA1 Message Date
Tim Hockin 21b32eea57 Change KYAML gate to on-by-default
Kubernetes-commit: 5af2b732beeae755c5a87b423659ab46968f4a14
2025-07-30 17:49:33 -07:00
Dharmit Shah 3cb662b4be JSON & YAML output for kubectl api-resources (#132604)
* Add JSON & YAML output support for kubectl api-resources

Create a separate `PrintFlags` struct within the apiresources.go file
that handles printing only for `kubetl api-resources` because existing
output formats, i.e., wide and name, are already implemented
independently from HumanReadableFlags and NamePrintFlags.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Use separate printer type for all options

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Unit tests for JSON & YAML outputs

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Separate file for print types

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Move JSON-YAML tests to separate function

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Fix broken unit test

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Unifying JSON & YAML unit test functions

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Fix linter errors

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* PR feedback and linter again

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

---------

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

Kubernetes-commit: cb33accc8fc4d44e902da4926eee7b828c5e51ec
2025-07-24 15:35:50 +00: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ü daf2914981 (kubectl apiresources): Use restclientgetter instead cmdutil.Factory
This PR changes `kubectl apiresources` command by  using restclientgetter
instead of cmdutil.Factory for loose coupling and a couple of minor refactorings.

This PR also unleashes migration of other commands depending on apiresources
via completion.

Kubernetes-commit: 50c93bfe04557eccb38b46cc4b99a6a3ec13f85b
2022-08-24 09:52:10 +03:00
Brian Pursley 7c5e877c4d Add categories to kubectl api-resources -o wide output
Add categories column to show which categories each
resource type belongs to.

Add --categories flag to allow filtering the output to
a specific category or set of categories.

Change verbs column to display verbs in a comma-delimited
list, consistent with other multi-value columns in the output.

Kubernetes-commit: a1330a405497479ea30319258e75435ba8321d61
2022-07-12 17:57:37 -04:00
Brian Pursley 96f0c72304 Add unit tests for api-resources and api-versions commands
Kubernetes-commit: 13e0120bf0662c4530df2badf1f8f73426cf9e51
2022-05-14 11:06:49 -04:00