QuestionAccepted answer
If clause in helm chart
Riccardo Califano
01 Mar 2026, 09:03 UTC
113.4K views1
How can I check if a variable is a boolean value "true" in helm chart? I have in Values.yaml a parameter set as:
myParameter: true
I don't understand well difference between:
{{- if .Values.service.myParameter }}
and
{{- if eq .Values.service.myParameter "true" }}
I want that flow goes in if clause if the parameter is set as boolean "true"
1 answer
Accepted answer · original discussion
codeaprendiz
Permalink04 Mar 2026, 09:03 UTC
You can use the following snipped for checking the boolean value
{{if (default .Values.seLinux true)}}
securityContext:
seLinuxOptions:
user: system_u
{{ end }}
Then the Values file will have following snippet
seLinux: true
Please let me know if this helps.
Your perspective belongs here.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.