Files
chart/library/ix-dev/charts/nextcloud/templates/postgres-secret.yaml
Stavros Kois bdea2a6f8f NAS-122722 / 24.04 / nextcloud - display db details on NOTES.txt (#1484)
* display db details on NOTES.txt

* typo
2023-08-29 15:53:58 +03:00

27 lines
954 B
YAML

{{- $secretName := "db-details" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
data:
{{/*
Lookup for the user shouldn't be needed in normal circumstances
But there was a typo before that resulted to a db-user with weird
characters. So to keep that user for existing installations we retrieve
it from the existing secret.
*/}}
{{/* Init values */}}
{{- $dbUser := ((include "postgres.DatabaseName" .Values) | b64enc) -}}
{{- $dbPass := (randAlphaNum 15 | b64enc) -}}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
{{/* If there is a previous secret, use that */}}
{{- $dbUser = (index .data "db-user") -}}
{{- $dbPass = (index .data "db-password") -}}
{{- end }}
db-user: {{ $dbUser }}
db-password: {{ $dbPass }}
{{/* Temprary store them on values to display it on NOTES */}}
{{ $_ := set .Values "nextcloudDbPass" $dbPass }}
{{ $_ := set .Values "nextcloudDbUser" $dbUser }}