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