persistent-volume.yml.j2 751 B

1234567891011121314151617181920212223242526
  1. ---
  2. apiVersion: v1
  3. kind: List
  4. items:
  5. {% for volume in persistent_volumes %}
  6. - apiVersion: v1
  7. kind: PersistentVolume
  8. metadata:
  9. name: "{{ volume.name }}"
  10. {% if volume.labels is defined and volume.labels is mapping %}
  11. labels:
  12. {% for key,value in volume.labels.items() %}
  13. {{ key }}: {{ value }}
  14. {% endfor %}
  15. {% endif %}
  16. spec:
  17. capacity:
  18. storage: "{{ volume.capacity }}"
  19. accessModes: {{ volume.access_modes | lib_utils_to_padded_yaml(2, 2) }}
  20. {{ (volume.storage.keys() | list)[0] }}: {{ volume.storage[(volume.storage.keys() | list)[0]] | lib_utils_to_padded_yaml(3, 2) }}
  21. {% if 'claimName' in volume.storage %}
  22. claimRef:
  23. name: {{ volume.storage.claimName }}
  24. namespace: default
  25. {% endif %}
  26. {% endfor %}