Added ability to supply backend's database creds via secret.

This commit is contained in:
Skyler Mäntysaari 2023-03-05 08:59:45 +02:00
parent 3c9966560d
commit b34176b7ec
4 changed files with 22 additions and 7 deletions

View File

@ -9,7 +9,7 @@ sources:
- https://github.com/TeamPiped/piped-proxy - https://github.com/TeamPiped/piped-proxy
keywords: keywords:
- streaming - streaming
version: 1.0.0 version: 1.1.0
appVersion: latest appVersion: latest
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
maintainers: maintainers:
@ -26,7 +26,5 @@ dependencies:
condition: postgresql.enabled condition: postgresql.enabled
annotations: annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: changed - kind: added
description: Updated to common v1.3.2 which bumps kubeVersion to 1.22. description: Ability to use a secret for backend database credentials
- kind: changed
description: Enabled the probes by default.

View File

@ -58,13 +58,20 @@ data:
hibernate.connection.url: {{.Values.backend.config.database.connection_url }} hibernate.connection.url: {{.Values.backend.config.database.connection_url }}
hibernate.connection.driver_class: {{.Values.backend.config.database.driver_class }} hibernate.connection.driver_class: {{.Values.backend.config.database.driver_class }}
hibernate.dialect: {{.Values.backend.config.database.dialect }} hibernate.dialect: {{.Values.backend.config.database.dialect }}
hibernate.connection.username: {{.Values.backend.config.database.username }} {{- if .Values.backend.config.database.secret }}
hibernate.connection.password: {{.Values.backend.config.database.password }} hibernate.connection.username: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "database.username" ) -}}
hibernate.connection.password: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "database.password") -}}
{{- end }}
{{- else if .Values.postgresql.enabled }} {{- else if .Values.postgresql.enabled }}
hibernate.connection.url: jdbc:postgresql://piped-postgresql/{{ .Values.postgresql.auth.database}} hibernate.connection.url: jdbc:postgresql://piped-postgresql/{{ .Values.postgresql.auth.database}}
hibernate.connection.driver_class: org.postgresql.Driver hibernate.connection.driver_class: org.postgresql.Driver
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.username: {{.Values.postgresql.auth.username }} hibernate.connection.username: {{.Values.postgresql.auth.username }}
hibernate.connection.password: {{.Values.postgresql.auth.password }} hibernate.connection.password: {{.Values.postgresql.auth.password }}
{{- else if not (.Values.postgresql.enabled .Values.backend.config.database.secret) }}
hibernate.connection.username: {{.Values.backend.config.database.username }}
hibernate.connection.password: {{.Values.backend.config.database.password }}
{{- else }}
{{- fail "Unable to figure out database configuration for backend configmap."}}
{{- end }} {{- end }}
SENTRY_DSN: SENTRY_DSN:

View File

@ -1,6 +1,13 @@
--- ---
{{- include "bjw-s.common.values.init" . }} {{- include "bjw-s.common.values.init" . }}
{{- define "common.getValueFromSecret" }}
{{- $obj := (lookup "v1" "Secret" .Namespace .Name).data -}}
{{- if $obj }}
{{- index $obj .Key | b64dec -}}
{{- end -}}
{{- end -}}
{{- define "app-template.hardcodedValues" -}} {{- define "app-template.hardcodedValues" -}}
# Set the nameOverride based on the release name if no override has been set # Set the nameOverride based on the release name if no override has been set

View File

@ -107,6 +107,9 @@ backend:
# dialect: org.hibernate.dialect.PostgreSQLDialect # dialect: org.hibernate.dialect.PostgreSQLDialect
# username: piped # username: piped
# password: changeme # 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
image: image: