Currently, we only have ConfigOptionEquals
function for config value check. To use a and
to evaluate a conditional expression mixed with license bool value like
repl{{ and (LicenseFieldValue "<LICENSE_FIELD_NAME :: boolean-typed>") (ConfigOptionEquals "<CONFIG_NAME: boolean-typed" "1") }}
You need to use ParseBool
For example, you have set option-1 false
and license-field-1 false
. Then the template is like
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data:
option-1: '{{repl ConfigOptionEquals "option-1" "0"}}'
license-field-1: '{{repl LicenseFieldValue "license-field-1" }}'
when: '{{repl and (LicenseFieldValue "license-field-1" | ParseBool) (ConfigOptionEquals "option-1" "0")}}'
After rendered by kots, you will have
data:
license-field-1: "false"
option-1: "true"
when: "false"
Without ParseBool
, you will always get true
as return for when