apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "nextcloud.fullname" . }}-postgres labels: helm.sh/chart: {{ include "nextcloud.chart" . }} {{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: database spec: replicas: 1 strategy: type: {{ .Values.nextcloud.strategy }} selector: matchLabels: {{- include "nextcloud.postgres.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: database template: metadata: labels: {{- include "nextcloud.postgres.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: database annotations: rollme: {{ randAlphaNum 5 | quote }} spec: containers: - name: {{ .Chart.Name }}-postgres 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: name: db-details key: db-password volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data - name: postgres-backup mountPath: /postgres_backups ports: - name: postgres-tcp containerPort: 5432 protocol: TCP volumes: - name: postgres-data {{- if ne (include "configuredPostgresHostPath" .) "" }} hostPath: path: {{ template "configuredPostgresHostPath" . }} {{- else }} emptyDir: {} {{- end }} - name: postgres-backup {{- if ne (include "configuredBackupPostgresHostPath" .) "" }} hostPath: path: {{ template "configuredBackupPostgresHostPath" . }} {{- else }} emptyDir: {} {{- end }}