{{- if and (eq .Values.registry.external false) .Values.registry.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
{{ include "docker-registry.labels" . | indent 4 }}
  name: {{ include "docker-registry.fullname" . }}
spec:
  accessModes:
{{- range .Values.registry.persistence.accessModes }}
    - {{ . | quote }}
{{- end }}
  resources:
    requests:
      storage: {{ .Values.registry.persistence.size }}
{{- if .Values.registry.persistence.storageClass }}
{{- if (eq "-" .Values.registry.persistence.storageClass) }}
  storageClassName: ""
{{- else }}
  storageClassName: {{ .Values.registry.persistence.storageClass | quote }}
{{- end }}
{{- end }}
{{- end -}}
