DEV Community

Cover image for yq for helm post-render instead of kustomize

Posted on


yq for helm post-render instead of kustomize

Spending several hours to get all resources patched with .metadata.labels using kustomize as helm post-render tool; Sometimes, the command kustomize removed an old subcommand (build)..sometimes, the command kustomize requires external plugins...etc

At the end, things works simply with a single yq command:

yq '. *= load("patch.yaml")' all.yaml
Enter fullscreen mode Exit fullscreen mode

Shipping that single command inside postrender script, then use it with helm: helm template -g ./my-chart --post-renderer ./postrender

yq is a portable CLI with 0 dependencies. That's why i like it against kustomize in this use case.

Find full example in this github repo

Top comments (1)

sloan profile image
Sloan the DEV Moderator


This is an awesome post! 🔥 In fact, the topic of your post would also work really well in The Ops Community too!

The Ops Community is a place for cloud engineers to share tips & tricks, tutorials, and career insights. Folks there commonly share information about DevOps and SecOps topics amongst other things.

Would you consider posting this article there too? Because The Ops Community is built on the same platform as DEV (Forem) you can fairly easily copy the Markdown and post your article there as well.

Really hope that you'll share your post with the community there and consider browsing the other Forem communities out there!