_volumes.tpl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{/*
  2. Volumes Configuration
  3. */}}
  4. {{- define "volumeConfiguration" }}
  5. {{- if or .Values.ixVolumes .Values.hostPathVolumes .Values.emptyDirVolumes }}
  6. volumes:
  7. {{ $host_p := list }}
  8. {{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }}
  9. - name: ix-host-path-{{ $.Release.Name }}-{{ $index }}
  10. hostPath:
  11. path: {{ $hostPathConfiguration.hostPath }}
  12. {{ $host_p = mustAppend $host_p $hostPathConfiguration.hostPath }}
  13. {{- end }}
  14. {{- range $index, $hostPathConfiguration := .Values.ixVolumes }}
  15. {{ $dsName := base $hostPathConfiguration.hostPath }}
  16. - name: ix-host-volume-{{ $.Release.Name }}-{{ $dsName }}
  17. hostPath:
  18. path: {{ $hostPathConfiguration.hostPath }}
  19. {{ $host_p = mustAppend $host_p $hostPathConfiguration.hostPath }}
  20. {{- end }}
  21. {{ include "common.storage.hostPathsValidation" $host_p }}
  22. {{- range $index, $emptyDirConfiguration := .Values.emptyDirVolumes }}
  23. - name: ix-emptydir-volume-{{ $.Release.Name }}-{{ $index }}
  24. emptyDir:
  25. medium: Memory
  26. {{- end }}
  27. {{- end }}
  28. {{- end }}
  29. {{/*
  30. Volume Mounts Configuration
  31. */}}
  32. {{- define "volumeMountsConfiguration" }}
  33. {{- if or .Values.hostPathVolumes .Values.ixVolumes .Values.emptyDirVolumes }}
  34. volumeMounts:
  35. {{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }}
  36. - mountPath: {{ $hostPathConfiguration.mountPath }}
  37. name: ix-host-path-{{ $.Release.Name }}-{{ $index }}
  38. readOnly: {{ $hostPathConfiguration.readOnly }}
  39. {{- end }}
  40. {{- range $index, $hostPathConfiguration := .Values.volumes }}
  41. - mountPath: {{ $hostPathConfiguration.mountPath }}
  42. name: ix-host-volume-{{ $.Release.Name }}-{{ $hostPathConfiguration.datasetName }}
  43. {{- end }}
  44. {{- range $index, $emptyDirConfiguration := .Values.emptyDirVolumes }}
  45. - mountPath: {{ $emptyDirConfiguration.mountPath }}
  46. name: ix-emptydir-volume-{{ $.Release.Name }}-{{ $index }}
  47. {{- end }}
  48. {{- end }}
  49. {{- end }}