pvc.j2 901 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. apiVersion: v1
  2. kind: PersistentVolumeClaim
  3. metadata:
  4. name: "{{obj_name}}"
  5. {% if labels is not defined %}
  6. labels:
  7. metrics-infra: support
  8. {% elif labels %}
  9. labels:
  10. {% for key, value in labels.items() %}
  11. {{ key }}: {{ value }}
  12. {% endfor %}
  13. {% endif %}
  14. {% if annotations is defined and annotations %}
  15. annotations:
  16. {% for key,value in annotations.items() %}
  17. {{key}}: {{value}}
  18. {% endfor %}
  19. {% endif %}
  20. spec:
  21. {% if volume_name is defined %}
  22. volumeName: {{volume_name}}
  23. {% endif %}
  24. {% if pv_selector is defined and pv_selector is mapping %}
  25. selector:
  26. matchLabels:
  27. {% for key,value in pv_selector.items() %}
  28. {{key}}: {{value}}
  29. {% endfor %}
  30. {% endif %}
  31. accessModes:
  32. {% for mode in access_modes %}
  33. - {{ mode }}
  34. {% endfor %}
  35. resources:
  36. requests:
  37. storage: {{size}}
  38. {% if storage_class_name is defined %}
  39. storageClassName: {{ storage_class_name }}
  40. {% endif %}