_volume.tpl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {{/*
  2. Retrieve volume configuration
  3. This expects a dictionary in the following format:
  4. {
  5. "name": string,
  6. "emptyDirVolumes": boolean,
  7. "ixVolumes": list,
  8. "hostPathEnabled": boolean,
  9. "pathField": string,
  10. "datasetName": string,
  11. }
  12. */}}
  13. {{- define "common.storage.volumeConfig" -}}
  14. {{- $values := . -}}
  15. {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "name")) -}}
  16. {{- if $values.emptyDirVolumes -}}
  17. - name: {{ $values.name }}
  18. emptyDir: {}
  19. {{- else -}}
  20. - name: {{ $values.name }}
  21. hostPath:
  22. path: {{ template "common.storage.configuredHostPath" $values }}
  23. {{- end -}}
  24. {{- end -}}
  25. {{/*
  26. Retrieve configuration for volumes
  27. This expects a dictionary to be provided in the following format:
  28. {
  29. "ixVolumes": list,
  30. "volumes": [
  31. {
  32. "name": string,
  33. "emptyDirVolumes": boolean,
  34. "hostPathEnabled": boolean,
  35. "pathField": string,
  36. "datasetName": string,
  37. }
  38. ] ( list of dicts )
  39. }
  40. */}}
  41. {{- define "common.storage.volumesConfiguration" -}}
  42. {{- $values := . -}}
  43. {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "ixVolumes" "volumes")) -}}
  44. {{- range $vol := $values.volumes -}}
  45. {{- $_ := set $vol "ixVolumes" $values.ixVolumes -}}
  46. {{- include "common.storage.volumeConfig" $vol | nindent 0 -}}
  47. {{- end -}}
  48. {{- end -}}