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

Selecting Array Elements with the Custom Columns Kubernetes CLI Output #5659

Closed
diegoavitorino opened this issue May 8, 2024 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@diegoavitorino
Copy link

How can I use the --output=custom-columns option for the the Kubernetes CLI (kubectl) to select array elements?

examnple: kubectl get service -o=custom-columns='NAME:.metadata.name,IP:.spec.clusterIP,PORT:.spec.ports[*].targetPort'

I'd like to use the same for kubectl get managed

EXTERNAL-NAME | NAME | READY | SYNCED

@diegoavitorino diegoavitorino added the enhancement New feature or request label May 8, 2024
@bobh66
Copy link
Contributor

bobh66 commented May 8, 2024

@diegoavitorino this seems to work:

kubectl get managed -o=custom-columns='NAME:.metadata.name,READY:.status.conditions[?(@.type=="Ready")].status,SYNCED:.status.conditions[?(@.type=="Synced")].status'

@diegoavitorino
Copy link
Author

Thanks a lot @bobh66

@diegoavitorino
Copy link
Author

diegoavitorino commented May 8, 2024

It works

@haarchri haarchri closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants