{{- if eq .Values.storage.type "filesystem" }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ include "hoard.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "hoard.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    helm.sh/chart: {{ include "hoard.chart" . }}
  annotations:
  {{- range $key, $value := $.Values.persistence.annotations }}
    {{ $key }}: {{ $value | quote }}
  {{- end }}
spec:
  accessModes:
  - {{ $.Values.persistence.accessMode | quote }}
  resources:
    requests:
      storage: {{ $.Values.persistence.size | quote }}
{{- if $.Values.persistence.storageClass }}
{{- if (eq "-" $.Values.persistence.storageClass) }}
  storageClassName: ""
{{- else }}
  storageClassName: "{{ $.Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
