Reputation: 1637
I would like to add https://hub.helm.sh/charts/bitnami/mysql as a dependency to my helm charts. So I added this to my Chart.yaml:
dependencies:
- name: mysql
version: "6.14.9"
repository: "https://charts.bitnami.com/bitnami"
How can I now get the service name the password and the user as environment variables in my main chart deployments to connect to the mysql server? Somehow all the documentation of the chart only ever mentions directly installing it with helm. Is it not correct to use a dependency here?
Upvotes: 0
Views: 1494
Reputation: 1784
The accepted answer here does not work.
For bitnami mysql 8.0.25, the correct syntax is:
mysql:
auth:
rootPassword: testing
username: user
password: user
Upvotes: 1
Reputation: 630
When you are using a dependency you can override the values.yaml for mysql chart from the parent chart and then inject those values as an environment variable or a secret into your main container.
in values.yaml of parent chart
mysql:
mysqlRootPassword: testing
mysqlUser: user
mysqlPassword: user
once you have these values you can use these values to create a secret and user volume mount or directly inject them as an environment variables.
For mysql server use the release name and chart name for most of the cases unless you are using a NameOverride or FullNameOverride
env:
- name: MYSQL_SERVER
value: {{ .Release.Name }}-mysql
Upvotes: 3