{{- if .Values.useDeployment }}
{{- $createPvc := and (empty .Values.storage.persistentVolumeClaimName) (.Values.storage.requestedSize) }}
{{- if $createPvc }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ include "mariadb.fullname" . }}
  labels:
    {{- include "mariadb.labels" . | nindent 4 }}
  {{- if .Values.storage.keepPvc }}
  annotations:
    "helm.sh/resource-policy": keep
  {{- end }}
spec:
  {{- with .Values.storage }}
  accessModes:
    {{- toYaml .accessModes | nindent 4 }}
  volumeMode: Filesystem
  resources:
    requests:
      storage: {{ .requestedSize }}
  {{- if .className }}
  storageClassName: {{ .className }}
  {{- end }}
  {{- end }}  
{{- end }}
{{- end }}
