Skip to content

Make explain --recursive=true produce all the descriptions in a machine-readable format (like YAML or JSON) #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jakub-mikians-airspace-intelligence opened this issue Apr 14, 2025 · 2 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@jakub-mikians-airspace-intelligence

What would you like to be added:

I would like to make kubectl explain in recursive mode to produce the exhaustive documentation of all the fields in a format that can be easily consumed by other tools. The output could be JSON or YAML.

Why is this needed:

I work on an autocompletion for Kubernetes resource templates (and helm templates). I need to learn the structure of all the possible fields. The recursive mode of explain command is perfect for this task, but has two drawbacks:

  1. It does not produce full textual description, as non-recursive mode does
  2. The output format needs custom handling, i.e. it's not a regular YAML (or JSON).

Ideally, I'd like to make the explain produce machine-readable output similar to the following:

% kubectl explain deployment --recursive=true --output=yaml

kind: Deployment
description: Description of Deployment Kind.
fields:
- spec:
    type: Object
    required: false
    description: Specification of the desired behavior of the Deployment.
    fields:
    - minReadySeconds:
        type: integer
        required: false
        description: Minimum number of seconds for which a newly created pod (...)


# ... continue recursively for all the fields.   
@jakub-mikians-airspace-intelligence jakub-mikians-airspace-intelligence added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 14, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 14, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jakub-mikians-airspace-intelligence

Closing. I can run kubectl proxy and call APIs there for openapi schemas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants