You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following template iterates over a range "entries" and inside each iteration checks if a value is set in the current iteration value:
# kubetpl:syntax:go-template
a-start: Here the YAML starts
{{- if isset "key" }}
msg: "Found value for key: {{ .key }}"
{{- else }}
error: "Key value is missing"
{{- end}}
an-output-entry:
{{ range $ig := .entries }}
- the-name: {{ .name }}
output: {{ .value }}
{{- if isset "print" }}
the-value-to-print: {{ .print }}
{{- end }}
{{ end }}
z-end: The last entry
Sample values:
key: some value
entries:
- name: one
value: first value
print: value to print
- name: two
value: the second
print: another value
- name: three
value: the third
The actual result:
---
a-start: Here the YAML starts
an-output-entry:
- output: first value
the-name: one
- output: the second
the-name: two
- output: the third
the-name: three
msg: 'Found value for key: some value'
The expected result:
---
a-start: Here the YAML starts
an-output-entry:
- output: first value
the-name: one
the-value-to-print: value to print
- output: the second
the-name: two
the-value-to-print: another value
- output: the third
the-name: three
msg: 'Found value for key: some value'
The check {{- if isset "print" }} fails always inside the retries range.
The text was updated successfully, but these errors were encountered:
The following template iterates over a range "entries" and inside each iteration checks if a value is set in the current iteration value:
Sample values:
The actual result:
The expected result:
The check
{{- if isset "print" }}
fails always inside the retries range.The text was updated successfully, but these errors were encountered: