Helm hasKey + ternary
1
feature_enabled_in_k8s_resource:
hasKey
The hasKey
function returns true
if the given dict contains the given key.
1
hasKey $myDict "name1"
If the key is not found, this returns false
.
ternary
The ternary
function takes two values, and a test value. If the test value is true, the first value will be returned. If the test value is empty, the second value will be returned. This is similar to the ternary operator in C and other programming languages.
true test value
1
ternary "foo" "bar" true
or
1
true | ternary "foo" "bar"
The above returns "foo"
.
false test value
1
ternary "foo" "bar" false
or
1
false | ternary "foo" "bar"
The above returns "bar"
.
This post is licensed under CC BY 4.0 by the author.