{{- if and .Values.backup.enabled .Values.backup.persistence.enabled (eq .Values.database.driver "postgres") }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ .Release.Name }}-backup
  labels:
    {{- include "armature.labels" . | nindent 4 }}
    app.kubernetes.io/component: backup
spec:
  accessModes:
    - {{ .Values.backup.persistence.accessMode | default "ReadWriteOnce" }}
  {{- if .Values.backup.persistence.storageClass }}
  storageClassName: {{ .Values.backup.persistence.storageClass | quote }}
  {{- end }}
  resources:
    requests:
      storage: {{ .Values.backup.persistence.size | default "5Gi" }}
{{- end }}
