Skip to content

Template for Helm Charts (including test framework)

Notifications You must be signed in to change notification settings

Kubedex/chart-test-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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')

About

Template for Helm Charts (including test framework)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published