Repository containing the source code for Helm charts used in the Trifork Data-platform.
Additionally, this repository contains a GitHub action for syncing the Flink operator. The reason for this, is that Apache does not release new versions of the operator to the same Helm repository, making upgrades difficult.
These helm charts are released to both GHCR (GitHub Container Registry) as OCI packages, and to GitHub releases as tar-ball assets.
For using the OCI packages, you need to log into the GHCR registry:
helm registry login ghcr.io/trifork/cheetah-charts
Log in using a GitHub account username and a PAT (Personal Access Token) that at least has the "read packages" permission. Once you are logged in, you can start using the charts:
helm template releaseName oci://ghcr.io/trifork/cheetah-charts/<chartName> [--version x.x.x]
You can find the available versions under packages. Helm does not currently support searching for versions in OCI repositories.
Currently, this is not possible as it requires a publicly hosted index.yaml
.
Linting will run on pull-requests to the main branch, which also tests that documentation is up to date. Additionally, pull-requests will also create a pre-release to GitHub releases, which can be tested on a live cluster.
After pull-requests has been merged to the main branch, charts that have changed version will be packaged and released.
For convenience, this repository uses make
for linting and generating docs. Most dev-boxes already have make
, and can easily be installed if you don't. On Windows, using chocolatey
, simply run:
choco install make
If you have docker installed on your system, the make commands will run inside docker, if you do not, they will require ct
and helm-docs
for linting and docs generation, respectively.
To lint a single chart you enter the directory of the chart and run helm lint
.
You can provide a file with values to test against. e.g.:
cd charts/flink-job
helm lint . --values ci/example-values.yaml
To run linting on your local machine, use make lint
at the root of this repository.
This will make use of ct
- a CLI for linting and testing on a running Kubernetes cluster.
Alternatively, if you require more fine-grained local linting, you can check the script lintchart.sh
It is setup to lint the charts on the cluster but can be edited to suit local development.
Example usage (identical to make lint
but for 1 directory only):
./lintchart.sh flink-job 20
To update documentation from your local machine, use make docs
at the root of this repository.
This will make use of helm-docs
to generate documentation based in the values.yaml
file in each chart.
It is possible to open an interactive shell with some pre-installed useful tools, by running:
docker run -it --network host --workdir=/data --rm --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.5.0
Unfortunately, this Docker container does not include make
, so it is not possible to run the make
commands mentioned above.
However, the other tools which are included in this shell, is very useful.
This includes tools such as helm
, ct
, and kubectl
.
For example, to render out the full manifest from the flink-job
Helm chart, run something like:
helm template my-test charts/flink-job -f charts/flink-job/ci/example-values.yaml --dependency-update > output.yaml
This will render the templates in charts/flink-job
using values in charts/flink-job/ci/example-values.yaml
and outputting them to output.yaml
as a release called my-test
.
The --dependency-update
flag makes sure that local chart dependencies are up to date.
It is not required after having run it once.
If you get errors using helm template
, often times it is because the generated manifests does not create valid YAML (most likely from indentation errors).
To make helm generate the template anyway, add --debug
to the helm template
command.
Sometimes Helm is not able to generate the template even with --debug
.
When this happens, it is most likely due to a nil pointer exception.
One of these errors might look like the following:
Error: template: flink-job/templates/servicemonitor.yaml:1:14: executing "flink-job/templates/servicemonitor.yaml" at <.Values.metrics.servicemonitor.enabled>: nil pointer evaluating interface {}.enabled
In this case it is caused by a spelling mistake in line 1
in servicemonitor.yaml
.
I am trying to access .Values.metrics.servicemonitor.enabled
instead of .Values.metrics.servicemonitor.enabled
.
As I haven't defined the servicemonitor
object in the values file, Helm (or rather, Go) errors out when I am trying to access the enabled
key in the object.
Changing the reference from .Values.metrics.servicemonitor.enabled
to .Values.metrics.servicemonitor.enabled
, the helm template
is successful again.
To run the linting command (the same included in Makefile
), run:
ct lint --config .github/ct-config.yaml