_ixvolumes.tpl 932 B

12345678910111213141516171819202122232425
  1. {{/*
  2. Retrieve host path from ix volumes based on dataset name
  3. */}}
  4. {{- define "common.storage.retrieveHostPathFromiXVolume" -}}
  5. {{- range $index, $hostPathConfiguration := $.ixVolumes }}
  6. {{- $dsName := base $hostPathConfiguration.hostPath -}}
  7. {{- if eq $.datasetName $dsName -}}
  8. {{- $hostPathConfiguration.hostPath -}}
  9. {{- end -}}
  10. {{- end }}
  11. {{- end -}}
  12. {{/*
  13. Retrieve host path from ix volumes based on a key
  14. */}}
  15. {{- define "common.storage.configuredHostPath" -}}
  16. {{- $values := . -}}
  17. {{- if $values.hostPathEnabled -}}
  18. {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "pathField")) -}}
  19. {{- $values.pathField -}}
  20. {{- else -}}
  21. {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "datasetName" "ixVolumes")) -}}
  22. {{- include "common.storage.retrieveHostPathFromiXVolume" (dict "datasetName" $values.datasetName "ixVolumes" $values.ixVolumes) -}}
  23. {{- end -}}
  24. {{- end -}}