Helm Notable Values

From NovaOrdis Knowledge Base
Revision as of 02:04, 9 February 2022 by Ovidiu (talk | contribs) (→‎Missing YAML Path Elements)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

Numeric Zero

For a numeric zero declared as:

myValue: 0

the following expressions evaluate to false:

Evaluates to false:

{{ if .Values.myValue }}

the following expressions evaluate to true:

{{ if empty .Values.myValue }}
{{ if (eq 0 (int .Values.myValue)) }}
{{ printf "%T" .Values.myValue }}

returns float64

{{ typeOf .Values.myValue }}

returns float64

Distinguishing between Zero and Empty String

{{- if kindIs "float64" .Values.myValue -}}
    {{- if .Values.myValue -}}
        {{- .Values.myValue -}}
    {{- else -}}
        0
    {{- end -}}
{{- end -}}

Boolean True

Boolean False

Empty Value (nil)

myValue:
{{ printf "%T" .Values.myValue }}

returns <nil>

{{ typeOf .Values.myValue }}

returns <nil>

Empty String

Missing YAML Path Elements

See:

if/else, nil pointer evaluating interface