What does HackerNews think of yq?

yq is a portable command-line YAML, JSON, XML, CSV and properties processor

Language: Go

#12 in Bash
#26 in Go
#7 in JSON
#2 in XML
For those pining for a similar yaml query tool for working through acres of config: https://github.com/mikefarah/yq

jq is awesome and thanks to the new team for their recent efforts and energy, it massively appreciated.

For anyone looking for such a script, there's some CLIs that make it easy. One is `yq -o props` [1], another way is to use `yq -j` or `yj` [2] to convert to JSON and pipe it to `gron` [3].

[1] https://github.com/mikefarah/yq

[2] https://github.com/sclevine/yj

[3] https://github.com/tomnomnom/gron

There actually is a yq [0] which I've used effectively for basic parsing and manipulation tasks on the command line. But I've no idea how well it handles YAML corner cases or how many advanced features it's missing compared to jq.

[0] https://github.com/mikefarah/yq

Also look at `yq` - https://github.com/mikefarah/yq

This is a wrapper to jq that also supports yaml and other file formats.

I actually used to sed configurations, now I use yq[0] whenever I need to programatically edit YAML/JSON. It has much less side effects.

But for Kubernetes manifests specifically, the right tool for the job is Kustomize[1] (which in that case does what Helm does for you, keeping dynamic variables separate). It ships with kubectl and I'm a big believer in using default tools when possible.

> Like you're installing new version, do you go over manifests and edit those by hand over and over every update?

I check the patch notes, diff the configuration files to see if anything new popped up, do the required changes if necessary, jump the version number and deploy.

It sounds laborious but it's really not that much work most of the time, and more importantly it forces you to have a good sense for what and how everything works. Plus it allows you to have a completely transparent, readable environment. Both are important for keeping things running in a production environment. Otherwise you might find yourself debugging incomprehensible systems you've never paid attention to in the middle of the night with 2 hours left before traffic starts coming in.

[0]: https://github.com/mikefarah/yq

[1]: https://kustomize.io

yq uses jq like syntax but works with YAML, JSON and XML.

https://github.com/mikefarah/yq