{{- if and .Values.persistence.enabled (not .Values.persistence.drupal.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ template "drupal.fullname" . }}-drupal
  labels:
    app: {{ template "drupal.fullname" . }}
    chart: {{ template "drupal.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
spec:
  {{- if .Values.persistence.drupal.hostPath }}
  storageClassName: ""
  {{- end }}
  accessModes:
    - {{ .Values.persistence.drupal.accessMode | quote }}
  resources:
    requests:
      storage: {{ .Values.persistence.drupal.size | quote }}
  {{ include "drupal.storageClass" . }}
{{- end -}}
