Issue tracker and mirror of kubectl code
Go to file
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
.github Update kubectl GitHub support issue template 2021-08-17 11:59:20 -06:00
docs Fix broken link to testgrid 2023-08-14 13:53:49 +05:30
images Adds kubectl logo images 2019-06-21 11:34:42 -07:00
pkg JSON & YAML output for kubectl api-resources (#132604) 2025-07-24 15:35:50 +00:00
testdata kuberc: pick the first known version when decoding + tests 2025-05-15 16:24:43 +02:00
CONTRIBUTING.md Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
LICENSE Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
OWNERS Update sig-cli OWNERS 2022-02-14 10:51:52 -07:00
README.md update go domain name 2022-09-15 19:01:51 +08:00
SECURITY_CONTACTS Update security contacts for sig-cli owned repos 2025-05-27 16:51:51 +02:00
code-of-conduct.md Adds staging directory for kubectl code 2019-05-29 23:31:23 -07:00
doc.go remove import doc comments 2024-12-02 14:43:58 +01:00
go.mod JSON & YAML output for kubectl api-resources (#132604) 2025-07-24 15:35:50 +00:00
go.sum JSON & YAML output for kubectl api-resources (#132604) 2025-07-24 15:35:50 +00:00

README.md

Kubectl

kubectl logo

Build Status GoDoc

The k8s.io/kubectl repo is used to track issues for the kubectl cli distributed with k8s.io/kubernetes. It also contains packages intended for use by client programs. E.g. these packages are vendored into k8s.io/kubernetes for use in the kubectl cli client. That client will eventually move here too.

Contribution Requirements

  • Full unit-test coverage.

  • Go tools compliant (go get, go test, etc.). It needs to be vendorable somewhere else.

  • No dependence on k8s.io/kubernetes. Dependence on other repositories is fine.

  • Code must be usefully commented. Not only for developers on the project, but also for external users of these packages.

  • When reviewing PRs, you are encouraged to use Golang's code review comments page.

  • Packages in this repository should aspire to implement sensible, small interfaces and import a limited set of dependencies.

Community, discussion, contribution, and support

See this document for how to reach the maintainers of this project.

Code of conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.