Home > Back-end >  How does a release reference to other releases?
How does a release reference to other releases?

Time:06-28

I have read the documentation of helm and know release = chart config. Now I am trying to compose the deployment of a classic web application, containing the following components:

  1. PostgreSQL
  2. Memcached
  3. Web Application webapp
helm install staging-pg stable/postgresql
helm install staging-memcached bitnami/memcached
helm install staging-webapp my-repo/blog

From my understanding, the third release needs to know the endpoint of PostgreSQL and Memcached. How to pass the endpoint of the database and Memcached to the third release?

CodePudding user response:

If you have that setup, then you need to pass the database hostname as a Helm value. A Helm chart doesn't have any direct way to get outputs or any other information from other releases.

# my-repo/blog/values.yaml
postgresql:
  host: staging-pg-postgresql
memcached:
  host: staging-memcached
# my-repo/blog/templates/deployment.yaml
env:
  - name: PGHOST
    value: {{ quote .Values.postgresql.host }}

Rather than separately install the dependencies you may find it more useful to use Helm dependencies to say that your blog application depends on the database and the cache. However, you will still need to know how those charts create their Service names. Often a pattern like {{ .Release.Name }}-postgres will work but this is more a convention than a hard rule.

  • Related