helmtk is a toolkit for Helm chart maintainers.

Structured Template Language

Helm charts struggle with indentation. Significant whitespace in YAML combined with a text-based template language leads to charts which are buggy and difficult to maintain.

  • maintain indentation with {{- and | nindent
  • ensure strings are quoted with | quote
  • convert objects with | toYaml
  • keep track of the meaning of . (and did you know about $?)
  • watch out for yes as a boolean
  • etc

{{- define "namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

metadata:
  labels:
    {{- with .Chart.AppVersion }}
    app.kubernetes.io/version: {{ . | quote }}
    {{- end }}
    {{- include "foo.selectorLabels" . | nindent 8 }}
    {{- with .Values.podLabels }}
    {{- toYaml . | nindent 8 }}
    {{- end }}

helmtk provides a structured template language, allowing templating without significant whitespace.

"ports": [
  { 
    "containerPort": 8000
    "name": "http"
  }

  if Values.debug do
    { "containerPort": 5005, "name": "debug" }
  end

  for name, port in Values.tcpPorts do
    { "containerPort": port, "name": name }
  end
]

The helmtk compile command compiles these structured templates into Helm chart templates.

Helm chart maintainers get the benefits of helmtk without disrupting users of the Helm charts.

"ports": [
  {
    "containerPort": 8000,
    "name": "http",
  },
  {{- if .Values.debug -}}
  {
    "containerPort": 5005,
    "name": "debug",
  },
  {{- end -}}
  {{- range $name, $port := .Values.tcpPorts -}}
  {
    "containerPort": {{ $port | toJson }},
    "name": {{ $name | toJson }},
  },
  {{- end }}
]

Test Runner

helmtk provides a test runner, with tests written in Javascript.

// helmtk/tests/example.js

test("test debug port", t => {
    t.Values.debug = true
    let res = t.render()[0]
    t.eq(res.ports[1].name, "debug")
})
> helmtk test .

example.js
  ✓ test debug port

Decompiler

The decompiler converts existing charts into helmtk tempates automatically, and writes a comprehensive test suite at the same time.

VS Code Extension

The helmtk VS Code extension provides:

  • syntax highlighting
  • formatting
  • navigation
  • running tests
  • debugging
  • and more

Pricing

Free

Free for personal, non-commercial use.

Includes all capabilities, except the decompiler.

Decompiler

$25 for the first 100,000 tokens.

$5 for additional 100,000 tokens.

The decompiler is currently in a limited beta. Join the waitlist:

Commercial Use

$50 per year

Commercial subscriptions are currently in limited beta. Join the waitlist:

Install

Using Go

go install github.com/helmtk/helmtk@latest

Using Homebrew

brew install helmtk/tap/helmtk

Pre-built binaries

Download pre-built binaries from the latest release.