Set postgres credentials in nextcloud deployment
This commit is contained in:
parent
817de8f1b0
commit
0995fc4923
|
@ -49,19 +49,19 @@ spec:
|
|||
{{- else }}
|
||||
{{- if eq .Values.externalDatabase.type "postgresql" }}
|
||||
- name: POSTGRES_HOST
|
||||
value: {{ .Values.externalDatabase.host | quote }}
|
||||
value: {{ template "nextcloud.fullname" . }}-postgres:5432
|
||||
- name: POSTGRES_DB
|
||||
value: {{ .Values.externalDatabase.database | quote }}
|
||||
value: "nextcloud"
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
|
||||
key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
|
||||
name: db-details
|
||||
key: db-user
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
|
||||
key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
|
||||
name: db-details
|
||||
key: db-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: NEXTCLOUD_ADMIN_USER
|
||||
|
|
|
@ -28,6 +28,11 @@ spec:
|
|||
image: "postgres:13.1"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: db-details
|
||||
key: db-user
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
|
|
@ -9,4 +9,5 @@ data:
|
|||
# `index` function is necessary because the property name contains a dash.
|
||||
# Otherwise (...).data.db_password would have worked too.
|
||||
db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }}
|
||||
db-user: postgres
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue