_configuration.tpl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {{- define "rsync.configuration" -}}
  2. {{- include "rsync.validation" $ }}
  3. configmap:
  4. config:
  5. enabled: true
  6. data:
  7. rsyncd.conf: |
  8. port = {{ .Values.rsyncNetwork.rsyncPort }}
  9. use chroot = yes
  10. pid file = /tmp/rsyncd.pid
  11. max connections = {{ .Values.rsyncConfig.maxConnections }}
  12. log file = /dev/stdout
  13. {{- range $aux := .Values.rsyncConfig.auxParams }}
  14. {{ printf "%v = %v" $aux.param $aux.value }}
  15. {{- end }}
  16. {{- $mods := list -}}
  17. {{- range $mod := .Values.rsyncModules }}
  18. {{- if $mod.enabled -}}
  19. {{- include "rsync.module.validation" (dict "mod" $mod) }}
  20. {{ printf "[%v]" $mod.name }}
  21. path = {{ printf "/data/%v" $mod.name }}
  22. max connections = {{ $mod.maxConnections }}
  23. uid = {{ $mod.uid }}
  24. gid = {{ $mod.gid }}
  25. {{- if $mod.comment }}
  26. comment = {{ $mod.comment }}
  27. {{- end }}
  28. {{- if eq $mod.accessMode "RO" }}
  29. write only = false
  30. read only = true
  31. {{- else if eq $mod.accessMode "WO" }}
  32. write only = true
  33. read only = false
  34. {{- else if eq $mod.accessMode "RW" }}
  35. read only = false
  36. write only = false
  37. {{- end }}
  38. {{- if $mod.hostsAllow }}
  39. hosts allow = {{ join " " $mod.hostsAllow }}
  40. {{- end }}
  41. {{- if $mod.hostsDeny }}
  42. hosts deny = {{ join " " $mod.hostsDeny }}
  43. {{- end }}
  44. {{- range $aux := $mod.auxParams }}
  45. {{- include "rsync.aux.validation" (dict "aux" $aux) }}
  46. {{ printf "%v = %v" $aux.param $aux.value }}
  47. {{- end }}
  48. {{- end }}
  49. {{- $mods = mustAppend $mods $mod.name }}
  50. {{- end }}
  51. {{- if not (deepEqual $mods (uniq $mods)) -}}
  52. {{- fail "Rsync - Module Names must be unique" -}}
  53. {{- end -}}
  54. {{- end -}}