Skip to content

feat: allow custom resources templating

Allow custom resources templating

Description

This merge request aims to introduce helm template support for custom resources inside the values.yaml file directly.

Example

In the values.yaml we can now use directly our Go Template interpreted correctly by Helm, thanks to tpl function.

customResources:
  - apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: "busybox-{{ .Release.Name }}-sa"
      namespace: "{{ .Release.Namespace }}"
  - apiVersion: v1
    kind: Pod
    metadata:
      name: "busybox-{{ .Release.Name }}-cr"
      namespace: "{{ .Release.Namespace }}"
    spec:
      serviceAccountName: "busybox-{{ .Release.Name }}-sa"
      containers:
        - name: "busybox-{{.Release.Name}}-cr"
          image: busybox:latest
          imagePullPolicy: IfNotPresent
          command: [ "sh", "-c", "echo Hello Kubernetes! && sleep 3600" ]

This yaml placed inside the values.yaml created two custom resources, one ServiceAccount named busybox-production-sa and one Pod named busybox-production-cr.

  • Please check this box if this contribution uses AI-generated content as outlined in the GitLab DCO & CLA
Edited by Jordan Labrosse

Merge request reports