2 min read
When writing helm charts being able to specify the files to use for ConfigMap or a Secret objects is way more convenient than having the object already rendered. Using .Files.Glob we can tell help to import a set of files into the object
08/07/2022
Read more...2 min read
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...1 min read
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...2 min read
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...2 min read
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...