skip to content
Alvin Lucillo

Helm helpers

/ 1 min read

Helpers can help with providing values across the helm chart. For example, app.name contains the the name of the release. This can then be used in the manifest file like {{ include "app.name" . }}.

_helpers.tpl

{{- define "app.name" -}}
{{ .Release.Name }}
{{- end -}}

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: { { include "app.name" . } }
spec:
  type: { { .Values.service.type } }
  selector:
    app: api
  ports:
    - protocol: TCP
      port: { { .Values.service.port } }
      targetPort: { { .Values.service.targetPort } }