Skip to content

Commit

Permalink
Merge pull request #134 from akash4sh/main
Browse files Browse the repository at this point in the history
Add postgresql as a dependency
  • Loading branch information
jebjohns authored Nov 7, 2023
2 parents 8607ec0 + 074010f commit aa8da8e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
7 changes: 6 additions & 1 deletion charts/grafana/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ name: grafana
sources:
- https://github.com/grafana/grafana
type: application
version: 1.0.3
version: 1.0.4
dependencies:
- name: postgresql
condition: postgresql.enabled
version: 1.0.0
repository: https://kube-tarian.github.io/helmrepo-supporting-tools/
10 changes: 10 additions & 0 deletions charts/grafana/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ containers:
- name: config
mountPath: "/etc/grafana/grafana.ini"
subPath: grafana.ini
{{- if .Values.postgresql.enabled }}
- name: {{ .Values.database.secretMount.name }}
mountPath: {{ .Values.database.secretMount.mountPath }}
readOnly: {{ .Values.database.secretMount.readOnly }}
{{- end }}
{{- if .Values.ldap.enabled }}
- name: ldap
mountPath: "/etc/grafana/ldap.toml"
Expand Down Expand Up @@ -605,6 +610,11 @@ volumes:
name: {{ tpl $name $root }}
{{- end }}
{{- end }}
{{- if .Values.postgresql.enabled }}
- name: {{ .Values.database.secretMount.name }}
secret:
secretName: {{ .Values.database.secretMount.secretName }}
{{- end }}
{{- if .Values.ldap.enabled }}
- name: ldap
secret:
Expand Down
10 changes: 10 additions & 0 deletions charts/grafana/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ data:
plugins: {{ join "," .Values.plugins }}
{{- end }}
grafana.ini: |
{{- if .Values.postgresql.enabled }}
[database]
enabled = {{ .Values.postgresql.enabled }}
type = {{ .Values.database.type }}
host = {{ .Values.database.host }}
name = {{ .Values.database.name }}
ssl_mode = {{ .Values.database.ssl_mode }}
user = {{ .Values.database.user }}
password = {{ .Values.database.password }}
{{- end }}
{{- range $key, $value := index .Values "grafana.ini" }}
[{{ $key }}]
{{- range $elem, $elemVal := $value }}
Expand Down
37 changes: 37 additions & 0 deletions charts/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -876,3 +876,40 @@ extraObjects: []
# data:
# - key: grafana-admin-password
# name: adminPassword

postgresql:
enabled: false
auth:
## @param auth.enablePostgresUser Assign a password to the "postgres" admin user. Otherwise, remote access will be blocked for this user
##
enablePostgresUser: true
## @param auth.postgresPassword Password for the "postgres" admin user. Ignored if `auth.existingSecret` is provided
##
postgresPassword: ""
## @param auth.username Name for a custom user to create
##
username: ""
## @param auth.password Password for the custom user to create. Ignored if `auth.existingSecret` is provided
##
password: ""
## @param auth.database Name for a custom database to create
##
database: ""
## @param auth.existingSecret Name of existing secret to use for PostgreSQL credentials. `auth.postgresPassword`, `auth.password`, and `auth.replicationPassword` will be ignored and picked up from this secret. The secret might also contains the key `ldap-password` if LDAP is enabled. `ldap.bind_password` will be ignored and picked from this secret in this case.
##
existingSecret: ""
metrics:
enabled: false

database:
type: postgres
host: grafana-postgresql:5432
name: postgres
ssl_mode: disable
user: postgres
password: $__file{/etc/secrets/postgresql/postgres-password}
secretMount:
name: postgresql-mount
mountPath: /etc/secrets/postgresql
secretName: grafana-postgresql
readOnly: true

0 comments on commit aa8da8e

Please sign in to comment.