How can we specify dependency configuration values when creating a Helm application chart?

6/5/2020

I'm creating a Chart for a web application that requires a Postgres database. As I understood dependencies are references to other charts that will be installed along with the one you define, e.g.:

# Chart.yaml
dependencies:
- name: bitnami/postgresql
  version: "8.10.5"
  repository: "https://charts.bitnami.com/bitnami"

My question is how can you specify the configuration properties (--set, or values.yaml file) needed not only in your application but also for each of the dependencies?

-- codependent
kubernetes
kubernetes-helm

2 Answers

6/5/2020

You can define your dependency charts in charts.yaml.You can also have conditions when you want your dependencies to be deployed or not.

Your dependecy chart is basically your child chart of the parent.A parent can always override the child chart values. In your parent values.yaml you can override child values like this

postgresql:
  ## Create a database user
  ## Default: postgres
  postgresqlUsername: username
  ## Default: random 10 character string
  postgresqlPassword: password@123
  postgresqlDatabase: database

You can also specify the override at the time of helm install using set command

-- Avinash Jha
Source: StackOverflow

6/5/2020

First of all, you should use name: postgresql and not name: bitnami/postgresql because charts are usually not prefixed.

Error: bitnami/postgresql chart not found in repo https://charts.bitnami.com/bitnami

You can override subcharts values putting them under chart name (in your case postgresql) in values.yaml

postgresql:
  postgresqlDataDir: /data/postgresql

Or with --set postgresql.postgresqlDataDir=/data/postgresql

More info in Subcharts and globals

-- edbighead
Source: StackOverflow