From 1c71fd24e06c788700a4172b177b30c6d8044e2e Mon Sep 17 00:00:00 2001 From: Richard Guthrie Date: Wed, 27 Sep 2017 14:58:33 -0700 Subject: [PATCH] Suggested edit to simple conditional example If drink is null or commented out in values.yaml, you need to check for existence or helm will throw an error as below: error calling eq: invalid type for comparison This change handles null or missing dring attribute in values.yaml which is commented out in a previous step in the quick start. --- docs/chart_template_guide/control_structures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 7575ebc35..408b355bb 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -53,7 +53,7 @@ data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | default "tea" | quote }} food: {{ .Values.favorite.food | upper | quote }} - {{ if eq .Values.favorite.drink "coffee" }}mug: true{{ end }} + {{ if ( .Values.favorite.drink ) and eq .Values.favorite.drink "coffee" }}mug: true{{ end }} ``` Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: