kubernetes / kubernetes/kubectl

Kubectl explain show "example" section for CRD fields

Open
#1,468 14 comments 0 reactions 0 assignees View on GitHub
kind/feature lifecycle/stale needs-triage triage/needs-information
Dominant language
Go
Stars
3.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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
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.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the kubectl explain command's handling of CRD field schemas and how it formats the DESCRIPTION output. Verify the behavior with a CRD containing an example value, and consider the work complete when kubectl explain CRD.FIELD displays that example section.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.