In a helm chart, we can define value as something like {{ Values.name }}, which will be replaced by the real value defined in values.yaml. But if the original value has the similar format such as {{name}}, when trying to install that chart, it will fail due to error that "name" is not defined. Is there any way to handle this?
9
votes
3 Answers
9
votes
You can escape double curly brackets in Go templates using {{ "{{" }}
.
But the best way is embedding the alerting rules as separate files:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-rules
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
prometheus: {{ template "fullname" . }}
data:
{{ (.Files.Glob "rules/*").AsConfig | indent 2 }}