It seems that helm does not support any template rendering capabilities in a values.yaml
file - there are multiple topics on the helm GitHub:
For now this feature is not implemented so you need to find a workaround - the suggestion from David Maze seems to be a good direction, but if you want to follow your approach you can use below workaround using --set
flag in the helm install
command or use sed
command and pipe to helm install
command.
First solution with --set
flag.
My values.yaml
file is little bit different than yours:
mariadb:
enabled: false
externalDatabase:
user: sqluser
database: jasper
jasperreportsUsername: jasper
That's because when I was using your values.yaml
I couldn't manage to apply these values to bitnami/jasperreports
chart, the helm install
command was using default values from here.
I'm setting a shell variable RELEASE_NAME
which I will use both for setting chart name and externalDatabase.host
value.
RELEASE_NAME=my-test-release
helm install $RELEASE_NAME bitnami/jasperreports -f values.yaml --set externalDatabase.host=$RELEASE_NAME-mysql
The above helm install
command will override default values both by setting values from the values.yaml
file + setting externalDatabase.host
value.
Before applying you can check if this solution works as expected by using helm template
command:
RELEASE_NAME=my-test-release
helm template $RELEASE_NAME bitnami/jasperreports -f values.yaml --set externalDatabase.host=$RELEASE_NAME-mysql
...
- name: MARIADB_HOST
value: "my-test-release-mariadb"
...
Another approach is to set a bash variable RELEASE_NAME
which will be used in the sed
command to output modified values.yaml
file (I'm not editing values.yaml
file itself). This output will be pipe into a helm install
command (where I also used theRELEASE_NAME
variable).
values.yaml
:
mariadb:
enabled: false
externalDatabase:
host: MYHOST
user: sqluser
database: jasper
jasperreportsUsername: jasper
RELEASE_NAME=my-test-release
sed "s/MYHOST/$RELEASE_NAME-mysql/g" values.yaml | helm install $RELEASE_NAME bitnami/jasperreports -f -
This approach will set chart configuration the same as in the first approach.