{{- if .Values.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- range $key, $value := .Values.pvc.name_and_capacity }}
{{- $applicationName := $key | trunc 63 }}
{{- $capacity := $value | trunc 63 }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ $applicationName }}
  namespace: {{ $namespace }}
  labels:
    cmii.type: {{ $.Values.cmii.label }}
    cmii.app: {{ $applicationName }}
    {{- include "uavcloud.pvc.labels.standard" $ | nindent 4 }}
spec:
  storageClassName: {{ $.Values.global.pvc.storageClass }}
  accessModes:
    - {{ $.Values.global.pvc.accessModes }}
  volumeMode: {{ $.Values.global.pvc.volumeMode }}
  resources:
    requests:
      storage: {{ $capacity | default $.Values.global.pvc.resources.requests.storage }}
---
{{- end }}
{{- end }}
