{{- if .Values.persistence.enabled }}
{{ range (until (.Values.chain.nodes | int)) }}
{{- $nodeNumber := printf "%03d" . }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ template "burrow.fullname" $ }}-{{ $nodeNumber }}
  labels:
    app: {{ template "burrow.name" $ }}
    release: {{ $.Release.Name }}
    nodeNumber: {{ $nodeNumber | quote }}
  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 }}
{{- end }}
