-
Notifications
You must be signed in to change notification settings - Fork 39.5k
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 manifest-query commandline utility for parsing JSON or YAML. #10326
Conversation
@@ -0,0 +1,130 @@ | |||
/* | |||
Copyright 2014 The Kubernetes Authors All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 2015
@davidopp for triage and, if applicable, pointing to two TL reviewers? |
See also #4348 |
Thanks for the pointer @bgrant0607. I'll merge those changes in once that issue is resolved (maybe in a follow-up PR depending on when it's merged). One thing I was considering was whether the command should just be part of the kubectl binary, perhaps as another sub-command ( |
The issue this PR addresses was marked v1.0-post. This PR is very low risk since it just adds a new binary, but in theory we're only accepting PRs that address 1.0 issues... |
Seems like a poor-man's jq. Could also just put jq into a docker container, like https://github.com/Gonzih/jq-docker We could put this into contrib for now and figure out what to do with it later. |
Ok, sounds like this needs some more discussion (post v1.0). If you want me to move this to contrib I'm happy to do so, or I can just archive the change until further notice. Thanks! |
Please just archive for now. I don't think this is critical for 1.0 |
Closing until we have a better idea of what we want out of this. |
I'd like to propose reopening this, or something like this. See #17241 (comment). We have chunks of deployment code that, for good or ill, need to query YAML files for specific fields, and no easy way to do it. In the case of #17241, the right way forward is honestly #9470, but that's going to take a while longer. I searched for something like |
BTW, here's the recommended approach from jq for yaml: https://github.com/stedolan/jq/wiki/FAQ#projects
It sounds like built in yaml support in jq is not going to happen for a long time. As something for use by our internal scripts (as opposed to something we encourage the use of) I think the utility in this PR would probably be better suited to the task than y2j |
@timstclair: I saw that, but then if we Dockerized |
@zmerlynn @timstclair Maybe dockerized python is an acceptable temporal solution. I am only concerned the size of the image is not small (~700mb) |
@zmerlynn |
@yifan-gu: That seems fine. If we did that, would you just use Dockerized |
Ack. |
Add a commandline utility for parsing arbitrary JSON or YAML, to make operations with these formats more feasible in bash scripts.
Resolves: #9937
Note: I'm not sure about the name, and am open to suggestions.
Examples
Keys with non-alpha numeric characters must be indexed with the
index
function: