Split Helm Charts
-
1 min read
Summary
If like me you generally prefer NOT to use Helm charts but would rather use Kustomize, you obviously wont be able to escape the ubiquity of Helm. This is not a condemnation of Helm, it is the superior way of distributing software to consumers when done right (GitLab, you know what you did). However in my opinion Kustomize is the better long term solution, so I prefer to template Helm charts out, then split them by Kind
and have Kustomize reference each file separately. Below is a very simple bash function to split a templated Helm chart into individual files and place them into directory named “base”. Note: you will need yq
.
function split_helm_chart(){
for item in $(cat ./$1 | yq '[.kind] | {"type": .}.type' | yq '. | unique | @tsv'); do
yq 'select(.kind == "'$item'")' ./$1 > ./base/$item.yaml
done
}