Reputation: 261
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?
Upvotes: 25
Views: 30271
Reputation: 7
Use pipe '|' and in next line pass txt with string what incluses {{ and }}
name: NAME_OF_VALUE
value: |
value_with{{rest_of_text}}and_other_text
Upvotes: -1
Reputation: 5690
You can embed it as a literal string with backticks:
{{`{{ "name" }}`}}
Upvotes: 45
Reputation: 28593
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 }}
Upvotes: 12