• Helm templates: Using fullname inside a range block

    2 min read

    helm template fullname range

    If we try to use the template fullname function inside a range block as follows:

    {{ range .Values.secrets }}
    ---
    apiVersion: 'kubernetes-client.io/v1'
    kind: ExternalSecret
    metadata:
      name: "{{ template "pet2cattle.fullname" . }}-{{ . | replace "_" "-" }}"
    (...)
    {{ end }}
    

    We will get a can't evaluate field Values in type string like follows:

    Error: template: pet2cattle/templates/_helpers.tpl:14:14: executing "pet2cattle.fullname" at <.Values.fullnameOverride>: can't evaluate field Values in type string
    

    29/12/2021

    Read more...
  • Helm: Get values for an installed application

    2 min read

    helm get values

    When we already have some applicacions installed using helm we might need to retrieve the values we used to install the same application somewhere else. To do so we can use helm get values

    02/12/2021

    Read more...
  • Helm: Usage of definitions across files

    1 min read

    helm template definition

    Sometimes writting helm charts can be very challenging due to the weird errors we might get:

    <sha256sum>: wrong type for value; expected string; got chartutil.Values
    

    26/11/2021

    Read more...
  • How to retrieve one of the elements of an array on a Helm template

    2 min read

    helm template array index element

    While working on Helm charts we might be interested on using a particular element of an array (most likely the first). To achieve this we won't be able to use the regular square brackets approach, instead we will have to use the index function

    25/11/2021

    Read more...
  • Helm: Include definitions on templates

    2 min read

    helm template include define

    Sometimes we might need to add the same content twice on the same Helm chart. A tipical example would be the labels on the Pods that need to match the selectos on the Service. For this when you create a helm chart there are already some default definitions, for example:

    {{/*
    Common labels
    */}}
    {{- define "pet2cattle.labels" -}}
    helm.sh/chart: {{ include "pet2cattle.chart" . }}
    {{ include "pet2cattle.selectorLabels" . }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    {{- end }}
    
    {{/*
    Selector labels
    */}}
    {{- define "pet2cattle.selectorLabels" -}}
    app.kubernetes.io/name: {{ include "pet2cattle.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    {{- end }}
    

    16/11/2021

    Read more...

More recent...

Older content...