Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

pkl-reader-helm

pkl-reader-helm provides a Pkl library and external resource reader for integrating Pkl with Helm.

Setup

CLI configuration:

--external-resource-reader reader+helm=pkl-reader-helm

PklProject configuration:

evaluatorSettings {
  externalResourceReaders {
    ["reader+helm"] {
      executable = "pkl-reader-helm"
    }
  }
}

Usage

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"
        }
      }
    }.resources

Handle 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