Skip to content

Helm

The Helm lexicon generates production-quality, parameterized Helm charts from typed TypeScript.

Unlike static manifest generators, the Helm lexicon produces real {{ .Values.x }} directives, values.yaml, values.schema.json, conditional resources, Helm hooks, and standard _helpers.tpl.

Install it with:

Terminal window
npm install --save-dev @intentius/chant-lexicon-helm @intentius/chant-lexicon-k8s
import { Chart, Values } from "@intentius/chant-lexicon-helm";
import { values, include, printf, toYaml } from "@intentius/chant-lexicon-helm";
import { Deployment, Service } from "@intentius/chant-lexicon-k8s";
export const chart = new Chart({
apiVersion: "v2",
name: "my-app",
version: "0.1.0",
type: "application",
});
export const valuesSchema = new Values({
replicaCount: 1,
image: { repository: "nginx", tag: "", pullPolicy: "IfNotPresent" },
service: { type: "ClusterIP", port: 80 },
});
export const deployment = new Deployment({
metadata: {
name: include("my-app.fullname"),
labels: include("my-app.labels"),
},
spec: {
replicas: values.replicaCount,
template: {
spec: {
containers: [{
name: "my-app",
image: printf("%s:%s", values.image.repository, values.image.tag),
ports: [{ containerPort: values.service.port, name: "http" }],
resources: toYaml(values.resources),
}],
},
},
},
});

Build the chart:

Terminal window
chant build
helm lint dist/
helm template test dist/
MetricCount
Resources5
Property types3
Services5
Intrinsic functions7
Pseudo-parameters0
Lint rules25

Lexicon version: 0.1.4
Namespace: Helm