_storageEntry.tpl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {{/* This is a shim generating yaml that will be passed
  2. to the actual templates later on the process.
  3. For that reason the validation is minimal as the
  4. actual templates will do the validation. */}}
  5. {{/* Call this template:
  6. {{ include "ix.v1.common.app.storageOptions" (dict "storage" $storage) }}
  7. */}}
  8. {{- define "ix.v1.common.app.storageOptions" -}}
  9. {{- $storage := .storage -}}
  10. {{- $size := "" -}}
  11. {{- $hostPath := "" -}}
  12. {{- $datasetName := "" -}}
  13. {{- $readOnly := false -}}
  14. {{- $server := "" -}}
  15. {{- $share := "" -}}
  16. {{- $domain := "" -}}
  17. {{- $username := "" -}}
  18. {{- $password := "" -}}
  19. {{- if $storage.readOnly -}}
  20. {{- $readOnly = true -}}
  21. {{- end -}}
  22. {{/* hostPath */}}
  23. {{- if eq $storage.type "hostPath" -}}
  24. {{- if not $storage.hostPathConfig -}}
  25. {{- fail (printf "Storage Shim - Expected non-empty [hostPathConfig]") -}}
  26. {{- end -}}
  27. {{- if $storage.hostPathConfig.aclEnable -}}
  28. {{- $hostPath = $storage.hostPathConfig.acl.path -}}
  29. {{- else -}}
  30. {{- $hostPath = $storage.hostPathConfig.hostPath -}}
  31. {{- end -}}
  32. {{- end -}}
  33. {{/* ixVolume */}}
  34. {{- if eq $storage.type "ixVolume" -}}
  35. {{- if not $storage.ixVolumeConfig -}}
  36. {{- fail (printf "Storage Shim - Expected non-empty [ixVolumeConfig]") -}}
  37. {{- end -}}
  38. {{- $datasetName = $storage.ixVolumeConfig.datasetName -}}
  39. {{- end -}}
  40. {{/* SMB Share */}}
  41. {{- if eq $storage.type "smb-pv-pvc" -}}
  42. {{- if not $storage.smbConfig -}}
  43. {{- fail (printf "Storage Shim - Expected non-empty [smbConfig]") -}}
  44. {{- end -}}
  45. {{- $server = $storage.smbConfig.server -}}
  46. {{- $share = $storage.smbConfig.share -}}
  47. {{- $domain = $storage.smbConfig.domain -}}
  48. {{- $username = $storage.smbConfig.username -}}
  49. {{- $password = $storage.smbConfig.password -}}
  50. {{- if $storage.smbConfig.size -}}
  51. {{- $size = (printf "%vGi" $storage.smbConfig.size) -}}
  52. {{- end -}}
  53. {{- end }}
  54. type: {{ $storage.type }}
  55. size: {{ $size }}
  56. hostPath: {{ $hostPath }}
  57. datasetName: {{ $datasetName }}
  58. readOnly: {{ $readOnly }}
  59. server: {{ $server }}
  60. share: {{ $share }}
  61. domain: {{ $domain }}
  62. username: {{ $username }}
  63. password: {{ $password }}
  64. {{- if eq $storage.type "smb-pv-pvc" }}
  65. mountOptions:
  66. - key: noperm
  67. {{- end }}
  68. {{- end -}}