{{- if .Values.persistence.enabled }}
{{- if not .Values.persistentVolumeClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ template "mysqldump.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "mysqldump.name" . }}
    helm.sh/chart: {{ include "mysqldump.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  accessModes: [{{ .Values.persistence.accessMode | quote }}]
  {{- if .Values.persistence.storageClass }}
  {{- if (eq "-" .Values.persistence.storageClass) }}
  storageClassName: ""
  {{- else }}
  storageClassName: "{{ .Values.persistence.storageClass }}"
  {{- end }}
  {{- end }}
  resources:
    requests:
      storage: {{ .Values.persistence.size }}
  persistentVolumeReclaimPolicy: {{ .Values.persistence.reclaimPolicy }}
{{- end -}}
{{- end -}}
