I read List and List Function but didn't find what I needed.
I have the following in my values.yaml
file.
# Default environment
environment: sandbox
environments:
- sandbox
- staging
- production
How can I get the index value of the environments
array based on a passed-in environment
during a helm install --set environment=xxx
command? So if I don't pass a value, I get 0
since the default environment is sandbox
. If I pass --set environment=production
, I get 2
.
I think I need the opposite of the index
function.
Note I know I can do a map
environments:
sandbox: 0
staging: 1
production: 2
and have
index .Values.environments .Values.environment
But there's got to be a way to do what I want to do with an array?