{{- if and (eq .Values.storage.mode "postgres") .Values.postgresql.enabled (not .Values.postgresql.external.enabled) }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "bifrost.fullname" . }}-postgresql namespace: {{ .Release.Namespace }} labels: {{- include "bifrost.labels" . | nindent 4 }} app.kubernetes.io/component: database spec: replicas: 1 strategy: type: Recreate selector: matchLabels: {{- include "bifrost.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: database template: metadata: labels: {{- include "bifrost.labels" . | nindent 8 }} app.kubernetes.io/component: database spec: securityContext: fsGroup: 999 containers: - name: postgresql image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}" imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }} ports: - name: postgresql containerPort: 5432 protocol: TCP env: - name: POSTGRES_USER value: {{ .Values.postgresql.auth.username | quote }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "bifrost.fullname" . }}-postgresql key: password - name: POSTGRES_DB value: {{ .Values.postgresql.auth.database | quote }} - name: PGDATA value: /var/lib/postgresql/data/pgdata livenessProbe: exec: command: - /bin/sh - -c - pg_isready -U "{{ .Values.postgresql.auth.username }}" initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 readinessProbe: exec: command: - /bin/sh - -c - pg_isready -U "{{ .Values.postgresql.auth.username }}" initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 resources: {{- toYaml .Values.postgresql.primary.resources | nindent 12 }} volumeMounts: - name: data mountPath: /var/lib/postgresql/data volumes: - name: data {{- if .Values.postgresql.primary.persistence.enabled }} persistentVolumeClaim: claimName: {{ include "bifrost.fullname" . }}-postgresql {{- else }} emptyDir: {} {{- end }} {{- end }}