'How to access dotted variable in values.yaml helm chart
Could you please help me how to access: database password in helm chart?
I tried this:
"{{ .Values "grafana.ini" database.name }}"
and many other modifications however, non of these worked for me.
grafana.ini:
paths:
data: /var/lib/grafana/data
logs: /var/log/grafana
plugins: /var/lib/grafana/plugins
analytics:
check_for_updates: true
log:
mode: console
grafana_net:
url: https://grafana.net
server:
database:
type: postgres
host: "127.0.0.1"
name: name
user: myuser
password: pass
Solution 1:[1]
Here is the answer:
initContainers:
- name: init
image: init:v0.0.1
env:
- name: DB_NAME
value: {{ (index .Values "grafana.ini" "database" "name" ) }}
- name: DB_USER
value: {{ (index .Values "grafana.ini" "database" "user" ) }}
- name: DB_PASS
value: {{ (index .Values "grafana.ini" "database" "password" ) }}
- name: SERVICE_DB_USER
value: "{{ .Values.serviceDbUser }}"
- name: REAL_DB_HOST
value: "{{ .Values.realDbHost }}"
- name: SERVICE_DB_PASS
value: "{{ .Values.serviceDbPass }}"
I got this from official slack kubernetes channel.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |