I've made the use of helm ternary operator and I think it's pretty need, but it seems to be only able to return boolean values. Can I have it return any arbitrary value instead of just true or false?
This works as expected
sharedVPC: {{ true | (eq .Values.global.hyperscaler "gcp") false | quote }}
I would love to be able to do something like this
reclaimJobHours: {{ ternary (eq .Values.global.hyperscaler "aws") "36" "34" }}
From sprig functions
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 c ternary operator.
{{ ternary "36" "34" (eq .Values.global.hyperscaler "aws")}}
The following expression will return 36 if global.hyperscaler
is aws
and 34 in all other cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With