kubectl icon indicating copy to clipboard operation
kubectl copied to clipboard

Kubectl explain show "example" section for CRD fields

Open bbkgh opened this issue 1 year ago • 7 comments

Hello all. How can users view examples for a field in CRD? kubectl explain CRD.FIELD doesn't show example section. for example:

....
              gitBranchName:
                default: main
                description: Git branch name that will be used for building your app.
                example: main
                type: string

kubectl explain crdName.spec.gitBranchName results to:

...

FIELD:    gitBranchName <string>
DESCRIPTION:
     Git branch name that will be used for building your app.

It's useful for users to see examples of field in explain command.

bbkgh avatar Aug 17 '23 10:08 bbkgh

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/test-infra repository.

k8s-ci-robot avatar Aug 17 '23 10:08 k8s-ci-robot

Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is retrieved from the server in OpenAPI format. image

Ithrael avatar Aug 17 '23 15:08 Ithrael

This is not what i'm looking for. I want to see field.example's value in kubectl explain of field. for example: kubectl explain crdName.spec.gitBranchName results to sth like:

FIELD:    gitBranchName <string>
DESCRIPTION:
     Git branch name that will be used for building your app.
EXAMPLE: main

bbkgh avatar Aug 17 '23 18:08 bbkgh

What is your kubectl version?(it is important because older versions look at openapi/v2 and newer versions use openapi/v3). Have you checked that openapi include example field and kubectl explain just does not render it or there isn't any such field in openapi(in this case, there is nothing we can do and we can close this as not a bug.)

ardaguclu avatar Sep 01 '23 12:09 ardaguclu

/triage needs-information

brianpursley avatar Sep 13 '23 16:09 brianpursley

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 28 '24 07:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 27 '24 08:02 k8s-triage-robot