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
As explained in #111, the current implementation of empty, and therefore default and coalesce, fails when attempting to use booleans or certain integers. However, there are many cases where an override value may be a legitimate 'false' or '0'.
For example, in helm charts, a paradigm such as follows is common:
values.yaml
global:
doThing: true
doThingOverride: null
deployment.yaml
{{- if .Values.doThingOverride | default .Values.global.doThing }}
In this case, even if doThingOverride is set to false, the global.doThing will always be used.
Adding a new set of functions would allow this paradigm to work without unfortunate workarounds like {{- if eq (coalesce (.Values.enableIngressOverride | quote) (.Values.global.enableIngress | quote)) (true | quote) }} and maintain backwards-compatabiity
The text was updated successfully, but these errors were encountered:
tculp
changed the title
Add safeEmpty and safeDefault functions which don't consider 0 or false to be empty
Add safeEmpty, safeDefault, and safeCoalesce functions which don't consider 0 or false to be empty
Jun 3, 2020
As explained in #111, the current implementation of empty, and therefore default and coalesce, fails when attempting to use booleans or certain integers. However, there are many cases where an override value may be a legitimate 'false' or '0'.
For example, in helm charts, a paradigm such as follows is common:
values.yaml
deployment.yaml
In this case, even if
doThingOverride
is set tofalse
, theglobal.doThing
will always be used.Adding a new set of functions would allow this paradigm to work without unfortunate workarounds like
{{- if eq (coalesce (.Values.enableIngressOverride | quote) (.Values.global.enableIngress | quote)) (true | quote) }}
and maintain backwards-compatabiityThe text was updated successfully, but these errors were encountered: