Using yq
command with the Helm postrender feature to patch YAML rendered by HELM with merge strategy.
Demonstrating that you don't need the complexity of kustomize in order to modify your YAML before being applyed by HELM.
But just the portable CLI yq
- helm CLI 3.10.0 or above
- yq CLI 4.30.4 or above (https://github.com/mikefarah/yq/releases)
- Check content of test.sh
- Run it and validate it works
bash test.sh
-
Scaffolding a helm chart
helm create my-chart
-
Create the patch file patch.yaml which includes some labels to be patched to all resources. If you want to select/filter resources by kind (for example), you may need to check this example
-
Creating the postrender script which calls
yq
command -
Writing the
test.sh
script which includes the testing commandhelm template
. As per helm docs, you can use--post-render
not only withhelm template
but also withhelm install
as wellhelm upgrade