37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
{{- if and (eq .Values.database.type "postgres") (.Values.database.create) -}}
|
|
apiVersion: postgresql.org/v1
|
|
kind: PostgresDatabase
|
|
metadata:
|
|
name: {{ .Release.Name }}-db
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
dbName:
|
|
envFrom:
|
|
configMapKeyRef:
|
|
- name: {{ .Release.Name }}-db-credentials
|
|
namespace: postgres-controller
|
|
key: db-name
|
|
dbRoleName:
|
|
envFrom:
|
|
configMapKeyRef:
|
|
- name: {{ .Release.Name }}-db-credentials
|
|
namespace: postgres-controller
|
|
key: db-user
|
|
dbRolePassword:
|
|
envFrom:
|
|
secretKeyRef:
|
|
- name: {{ .Release.Name }}-db-password
|
|
namespace: postgres-controller
|
|
key: password
|
|
# Because we've adopted a "throw away"/"ephemeral"/"container-esk" approach to our database, we want it to be dropped/deleted when everything else is deleted.
|
|
# This is because we re-create it and restore from a backup on every deploy.
|
|
# Which helps keep the data current and reinforces the utility of the backup and restore systems.
|
|
onDeletion:
|
|
# Whether to drop the database when the resource is deleted
|
|
dropDB: true
|
|
# Whether to drop the role when the resource is deleted
|
|
dropRole: true
|
|
{{- if .Values.database.instance_id }}
|
|
dbInstanceId: {{ .Values.database.instance_id }}
|
|
{{- end }}
|
|
{{- end -}}
|