kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.89k stars 924 forks source link

Add machine readable --output options to `kubectl api-resources` #1382

Open grant0417 opened 1 year ago

grant0417 commented 1 year ago

What would you like to be added?

Currently the kubectl api-resources command --output flag only takes wide or name, a machine readable format such as json would be useful for scripting/utilizing kubectl

Why is this needed?

I am a dev at fig and help maintain the autocomplete repo, we generate completions for the kubectl CLI based on kubectl api-resources --output name right now, but this lacks support for short names which are hard to parse from the human readable kubectl api-resources, which would be easily parsed from a kubectl api-resources --output json command.

This might be a much less common use case for others but it still feels useful to have machine readable output for as many --output flags as possible.

k8s-ci-robot commented 1 year ago

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
grant0417 commented 1 year ago

/sig cli

XDRAGON2002 commented 1 year ago

This sound like a decent issue to start with as a new contributor I feel? Could I take this up if it gets accepted by a sig?

ardaguclu commented 1 year ago

/transfer kubectl

XDRAGON2002 commented 1 year ago

/assign

eddiezane commented 1 year ago

/triage accepted /priority backlog

Reasonable request. Thanks for offering to work on it @XDRAGON2002. Let me know if you run into issues with the printers.

@grant0417 earliest this would make it in is 1.28 so if you're time pressed you could essentially walk and build your own via

kubectl get --raw /apis
grant0417 commented 1 year ago

Oh interesting! No, not a major rush here. Just want to improve some of our ux but it isn't a major priority.

Thanks @eddiezane and @XDRAGON2002

XDRAGON2002 commented 1 year ago

Thanks @eddiezane @grant0417, have opened a PR for the same, you can have a look.

dharmit commented 6 months ago

I'd like to work on this.

/assign