From cfec6a87830b3d95645f50093600914c350bf694 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Wed, 24 Jan 2024 10:49:48 +0000 Subject: [PATCH] Allow overriding of secret keys for database (#78) Increment Chart version --- charts/apps/piped/Chart.yaml | 4 ++-- charts/apps/piped/templates/backend/configmap.yaml | 6 +++--- charts/apps/piped/values.yaml | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/charts/apps/piped/Chart.yaml b/charts/apps/piped/Chart.yaml index d3b9057..6704543 100644 --- a/charts/apps/piped/Chart.yaml +++ b/charts/apps/piped/Chart.yaml @@ -10,7 +10,7 @@ sources: - https://github.com/TeamPiped/piped-proxy keywords: - streaming -version: 4.1.2 +version: 5.0.0 appVersion: latest kubeVersion: ">=1.22.0-0" maintainers: @@ -28,4 +28,4 @@ dependencies: annotations: artifacthub.io/changes: |- - kind: changed - description: Upgraded `postgresql` chart dependency to version 13.2.27 + description: Change database values configuration to allow overriding of secret keys for database diff --git a/charts/apps/piped/templates/backend/configmap.yaml b/charts/apps/piped/templates/backend/configmap.yaml index f015671..1a3c9f3 100644 --- a/charts/apps/piped/templates/backend/configmap.yaml +++ b/charts/apps/piped/templates/backend/configmap.yaml @@ -65,9 +65,9 @@ data: hibernate.connection.username: {{.Values.backend.config.database.username }} hibernate.connection.password: {{.Values.backend.config.database.password }} {{ end }} - {{- if .Values.backend.config.database.secret }} - hibernate.connection.username: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "DB_USERNAME" ) }} - hibernate.connection.password: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "DB_PASSWORD") }} + {{- if and (.Values.backend.config.database.secret) (.Values.backend.config.database.secret.name) }} + hibernate.connection.username: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret.name "Key" (.Values.backend.config.database.secret.username | default "DB_USERNAME")) }} + hibernate.connection.password: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret.name "Key" (.Values.backend.config.database.secret.password | default "DB_PASSWORD")) }} {{- end }} {{- else if .Values.postgresql.enabled }} hibernate.connection.url: jdbc:postgresql://piped-postgresql/{{ .Values.postgresql.auth.database}} diff --git a/charts/apps/piped/values.yaml b/charts/apps/piped/values.yaml index 356d8b1..37cc4c8 100644 --- a/charts/apps/piped/values.yaml +++ b/charts/apps/piped/values.yaml @@ -99,7 +99,11 @@ backend: # password: changeme # Please only provide the secret name (it should already exist), # it should only include database.username and database.password as others will be taken from above. - # secret: secret-name + # secret: + # name: secret-name + # Optionally grab differently named keys + # username: DB_USERNAME + # password: DB_PASSWORD image: