Are a lot of your Helm Charts similar? And are you copying them around your applications? Create a Helm Starter and whip up a chart in an instance!
Read more about starters at the Helm docs here.
In the following we are going to create a starter that creates charts like the one for the java-spring-api that we used in a previous post on Helm. The full code of the starter is found on github here.
Use a Starter
Let’s dive into it! Clone the repository with the final starter code into your helm configuration folder.
git clone https://github.com/sybrenbolandit/helm-starters.git ~/.helm/starters
Now we can create a helm chart like with the following command.
helm create -p java-api java-spring-api
The only TODO is that we have to copy our application.properties to the value files. Then we are ready to helm install our java-spring-api!
Note: If you want to know more on the constructed chart or how to deploy these charts, read this previous post on Helm.
Explain the parts
When we compare the code of the starter with the resulting chart we see that the two are almost identical. The only parameter in the starter that is new is the chartname that we specify in the create-command. Here we see the template for the Chart.yaml with the variable <CHARTNAME>.
apiVersion: v1 name: java-api description: A Helm chart for <CHARTNAME> version: 0.1.0 appVersion: 0.1.0
And that’s it! We created an easy way to replicate similar Helm charts.
Hopefully you can now create Charts with your own Helm starter and pick up some speed. Happy Charting!