_volumes.tpl 1.6 KB

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