This repository is a proof of concept for building simplified Helm charts from Jsonnet libraries. It only supports string variables.
The values.yaml
file is constructed using the top level _config
hidden object that is common to most Kubernetes Jsonnet libraries such as cortex-jsonnet.
A dummy _config
object is used in the Tanka/Jsonnet evaluation process to put the appropriate Go template strings in place for Helm templating. For more detail see the environments/cortex/main.jsonnet
file.
See the Makefile to view the targets involved. To reconstruct all the files and view the resulting helm chart
$ make -B
$ helm template helm/cortex --generate-name
The dummy helm config is constructed using the template
function in lib/helm.libsonnet
;
Helm uses Go templates which can cause issues when Jsonnet libraries have Go templates themselves like in the prometheus-ksonnet library. This is
an issue with helm (helm/helm#2798).
To work around this, an escape
function has been written that has Helm render raw strings. For an example, see the environments/prometheus-ksonnet/main.jsonnet
file.
For nixos:
$ nix-shell
or if you have Lorri and direnv:
$ direnv allow
Otherwise, you need tanka, jsonnet-bundler, helm, and jsonnet