Skip to content
Template for Helm Charts (including test framework)
Makefile Smarty
Branch: master
Clone or download
Latest commit 908c070 Aug 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
grafana
tools initial commit Aug 9, 2019
.gitignore initial commit Aug 9, 2019
Makefile initial commit Aug 9, 2019
README.md Update README.md Aug 9, 2019
values.yaml initial commit Aug 9, 2019

README.md

chart-test-template

Clone this repo as a starting point for any new Helm Chart you'd like to create. This template supports one chart per repo.

asciicast

Delete the grafana directory which is used as an example.

Create a new chart by running helm create chartname.

When ready to test you can run make. This will start a K3s docker container, install helm and tiller, and execute helm upgrade --install on your chart directory.

By default make will also run helm lint and helm test on your installed chart.

You can leave the K3s docker container running and continue to iterate installation and tests by running make chart to upgrade the chart and make lint and make test.

To remove the chart from a running container use make chartrm. You can then install cleanly again using make chart.

To investigate chart problems you can run make ssh to log into the K3s container and run the usual kubectl and helm commands to troubleshoot.

To kill everything and start from scratch including terminating the K3s container use make clean.

Tests

We execute helm test inside the docker container against the release that was installed. This runs the tests defined in chartname/templates/tests. The Grafana chart included in this repo has some good examples that you can read.

Local chart value overrides

Sometimes it's useful to override the values.yaml for local testing. Put any overrides into the values.yaml in the root of this repo.

Gotchas

The Makefile works out the name of the chart based upon directories that exist in the repo. If you add more directories you'll need to exclude them.

For example to exclude a ci and docs directory that you want to add update this line in the Makefile.

CHARTNAME := $(shell ls -1d */ | sed 's\#/\#\#' | grep -v 'tools\|ci\|docs')
You can’t perform that action at this time.