{%- if k8s_deploy.spec.volumes %}
{%- for vol in k8s_deploy.spec.volumes %}
{%- if vol.persitentVolumeClaim %}
{%- if vol.persitentVolumeClaim.storageClassName == "manual" %}
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: {{vol.name}}
  namespace: {{k8s_deploy.namespace}}
  labels:
    {%- for label in k8s_deploy.labels %}
    {{label.key}}: {{label.value}}
    {%- endfor %}
spec:
  storageClassName: {{vol.persitentVolumeClaim.storageClassName}}
  capacity:
    storage: {{vol.persitentVolumeClaim.storage}}
  {%- if vol.persitentVolumeClaim.modes %}
  accessModes:
  {%- for mode in vol.persitentVolumeClaim.modes %}
  - {{mode}}
  {%- endfor %}
  {%- endif %}
  hostPath:
    path: {{vol.persitentVolumeClaim.hostPath}}
{%- endif %}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{vol.persitentVolumeClaim.name}}
  namespace: {{k8s_deploy.namespace}}
  labels:
    {%- for label in k8s_deploy.labels %}
    {{label.key}}: {{label.value}}
    {%- endfor %}
spec:
  storageClassName: {{vol.persitentVolumeClaim.storageClassName}}
  {%- if vol.persitentVolumeClaim.modes %}
  accessModes:
  {%- for mode in vol.persitentVolumeClaim.modes %}
  - {{mode}}
  {%- endfor %}
  {%- endif %}
  {#
  {%- if vol.persitentVolumeClaim.reclaimPolicy %}
  persistentVolumeReclaimPolicy: {{vol.persitentVolumeClaim.reclaimPolicy}}
  {%- endif %}
  #}
  resources:
    requests:
      {%- if vol.persitentVolumeClaim.storage %}
      storage: {{vol.persitentVolumeClaim.storage}}
      {%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}
