apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mariadb-volume-claim
  {{- if .Values.persistence.keep }}
  annotations:
    "helm.sh/resource-policy": keep
  {{- end }}
spec:
  accessModes:
  {{- if .Values.persistence.accessMode }}
  - {{ .Values.persistence.accessMode }}
  {{- else if eq (int .Values.replicaCount) 1 }}
  - ReadWriteOnce
  {{- else }}
  - ReadWriteMany
  {{- end }}
  resources:
    requests:
      storage: {{ .Values.persistence.size }}
  {{- if .Values.persistence.storageClass }}
  storageClassName: {{ .Values.persistence.storageClass }}
  {{- end }}
  volumeMode: Filesystem
