mirror of
https://github.com/truenas/charts.git
synced 2026-04-13 17:52:13 +08:00
27 lines
954 B
YAML
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 }}
|