From 2565bef5636c1583d8889735d5476a099fd11ff7 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 24 Oct 2023 19:29:01 +0200 Subject: [PATCH] [kimai2] support mariadb.auth.existingSecret possible fix #69 --- charts/kimai2/templates/_helpers.tpl | 9 ++++++++- charts/kimai2/values.yaml | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/charts/kimai2/templates/_helpers.tpl b/charts/kimai2/templates/_helpers.tpl index b0164b6..905fb85 100644 --- a/charts/kimai2/templates/_helpers.tpl +++ b/charts/kimai2/templates/_helpers.tpl @@ -105,7 +105,14 @@ Return the MariaDB Password */}} {{- define "kimai.databasePassword" -}} {{- if .Values.mariadb.enabled }} - {{- printf "%s" .Values.mariadb.auth.password -}} + {{- if .Values.mariadb.existingSecret }} + {{- $secret := (lookup "v1" "Secret" .Release.Namespace (include "mariadb.secretName" .)).data -}} + {{- if hasKey $secret "mariadb-password" }} + {{- printf "%s" (get $secret "mariadb-password") -}} + {{- end -}} + {{- else -}} + {{- printf "%s" .Values.mariadb.auth.password -}} + {{- end -}} {{- else -}} {{- printf "%s" .Values.externalDatabase.password -}} {{- end -}} diff --git a/charts/kimai2/values.yaml b/charts/kimai2/values.yaml index ab89fa4..4151240 100644 --- a/charts/kimai2/values.yaml +++ b/charts/kimai2/values.yaml @@ -847,6 +847,9 @@ mariadb: database: kimai username: kimai password: kimai + ## @param mariadb.auth.existingSecret Use existing secret for password details (`mariadb.auth.rootPassword`, `mariadb.auth.password` will be ignored and picked up from this secret). + ## The secret has to contain the keys `mariadb-root-password` and `mariadb-password` + existingSecret: "" ## MariaDB Primary configuration ## primary: