pkl-reader-helm provides a Pkl library and external resource reader for integrating Pkl with Helm.
CLI configuration:
--external-resource-reader reader+helm=pkl-reader-helmPklProject configuration:
evaluatorSettings {
externalResourceReaders {
["reader+helm"] {
executable = "pkl-reader-helm"
}
}
}Basic usage:
import "@helm/helm.pkl"
import "@k8s/K8sResource.pkl"
resources: Mapping<String, K8sResource> =
new helm.Template {
chart = "path/to/my/chart" // chart repo/name, oci:// URI, or absolute path on disk
version = "0.1.0" // chart versions (if using OCI or repo, may be null)
releaseName = "my-release" // release name to use for the chart templates
namespace = "my-namespace" // namespace to use for the chart templates (see `helm template --namespace`)
values = new Dynamic { // custom values to pass into the helm chart
image {
repository = "my-registry.example.com/nginx"
}
}
}.resourcesHandle Kubernetes Custom Resources:
import "@helm/helm.pkl"
import "@k8s/K8sResource.pkl"
import "@monitoring.coreos.com/v1/ServiceMonitor.pkl"
resources: Mapping<String, K8sResource> =
new helm.Template {
// ...
customResourceTemplates {
[ServiceMonitor.kind] {
[ServiceMonitor.apiVersion] = new ServiceMonitor {}
}
}
}.resources