In this post we will check out the helm stater template charts
- Generally there are two types of helm charts Application and Library.
- Apart from this we have a starter chart that helps as a template to create charts. This is used with helm create command.
- They are helpful in templating the charts that needs be created.
using a sample in GitHub to get started, we can see how this works
pre requisite - helm ( in the example we are using helm v3.6.3 )
clone the repo
Create a environment variable $XDG_DATA_HOME which points to a folder of your choice and move sample-starter-chart folder from the cloned repository to $XDG_DATA_HOME/helm/starters path.
Starter charts needs to be available in the path so that the helm create command can refer this template
Notice that we have many places in the chart, this is the value which gets replaced with the chart name that is given during creation time.
We can have object names derived with so all the charts created from this template is unique. (readme gives details of this chart)
Run the helm create command with starter option
$ helm create myapp --starter sample-starter-chart
this creates a myapp chart replacing the values in the starter chart template.
We can customize the object names using the _helper.tpl functions. This way we can create names as per the that is used in the files like deployment.yaml
This is a great way to have a reusable template that helps in building new charts. And to enforce certain components or resources that needs to be available in the created charts.
Note - chart.yaml created does not inherit the chart.yaml from the starter chart. That is a setback as we don't get the version or dependency charts from the template.