persistent-volume.yml.j2 580 B

123456789101112131415161718192021
  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 | to_padded_yaml(2, 2) }}
  20. {{ volume.storage.keys()[0] }}: {{ volume.storage[volume.storage.keys()[0]] | to_padded_yaml(3, 2) }}
  21. {% endfor %}