Skip to content
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

Add optional full yaml paths to kubectl explain output #1604

Open
spkane opened this issue May 28, 2024 · 5 comments
Open

Add optional full yaml paths to kubectl explain output #1604

spkane opened this issue May 28, 2024 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@spkane
Copy link

spkane commented May 28, 2024

What would you like to be added: It would be GREAT if there was a way to get kubectl explain to output the full yaml path for each entry, especially when --recursive is set.

So, output that looks like this today:

  metadata	<ObjectMeta>
    annotations	<map[string]string>
    managedFields	<[]ManagedFieldsEntry>
      apiVersion	<string>
      fieldsType	<string>

might look like this:

  metadata	<ObjectMeta>      [metadata]
    annotations	<map[string]string>      [metadata.annotations]
    managedFields	<[]ManagedFieldsEntry>      [metadata.managedFields]
      apiVersion	<string>      [metadata.managedFields.apiVersion]
      fieldsType	<string>      [metadata.managedFields.apiVersion]

Why is this needed:

In addition to using kubectl explain to find out what a field is for and what type it expects, it could be very useful in determining where in the YAML structure a section belongs. With this change, running something like the following would make it much clearer WHERE the section belongs in the YAML manifest.

$ kubectl explain pod --recursive=true | grep preferredDuringSchedulingIgnoredDuringExecution

        preferredDuringSchedulingIgnoredDuringExecution	<[]PreferredSchedulingTerm>    
  [spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution]
        preferredDuringSchedulingIgnoredDuringExecution	<[]WeightedPodAffinityTerm>    
  [mspec.affinity.podAffinity.preferredDuringSchedulingIgnoredDuringExecution]
        preferredDuringSchedulingIgnoredDuringExecution	<[]WeightedPodAffinityTerm>    
  [mspec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution]
@spkane spkane added the kind/feature Categorizes issue or PR as related to a new feature. label May 28, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 28, 2024
@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.

@spkane
Copy link
Author

spkane commented Jul 3, 2024

@eddiezane @soltysh Is this something that seems reasonable? If I have some time I might try and make this happen if there are no general issues with the idea.

@mpuckett159
Copy link
Contributor

I think this might be best suited as a plugin to start out with. I'm a little reluctant to accept this because this would make the output pretty cluttered, and this information is generally available elsewhere. If you're willing to put together a PR for us to look at more directly.

Note, I would expect metadata.managedFields to be metadata.managedFieldEntry[] or something else that denotes it's a list.

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 15, 2024
@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 14, 2024
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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

4 participants