_deluge.tpl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {{- define "deluge.workload" -}}
  2. workload:
  3. deluge:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. securityContext:
  9. fsGroup: {{ .Values.delugeID.group }}
  10. hostNetwork: {{ .Values.delugeNetwork.hostNetwork }}
  11. containers:
  12. deluge:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: 0
  18. runAsGroup: 0
  19. runAsNonRoot: false
  20. readOnlyRootFilesystem: false
  21. capabilities:
  22. add:
  23. - CHOWN
  24. - DAC_OVERRIDE
  25. - FOWNER
  26. - SETGID
  27. - SETUID
  28. {{ with .Values.delugeConfig.additionalEnvs }}
  29. envList:
  30. {{ range $env := . }}
  31. - name: {{ $env.name }}
  32. value: {{ $env.value }}
  33. {{ end }}
  34. {{ end }}
  35. probes:
  36. liveness:
  37. enabled: true
  38. type: http
  39. port: 8112
  40. path: /
  41. readiness:
  42. enabled: true
  43. type: http
  44. port: 8112
  45. path: /
  46. startup:
  47. enabled: true
  48. type: http
  49. port: 8112
  50. path: /
  51. initContainers:
  52. config:
  53. enabled: true
  54. type: init
  55. imageSelector: image
  56. securityContext:
  57. runAsUser: 0
  58. runAsGroup: 0
  59. runAsNonRoot: false
  60. readOnlyRootFilesystem: false
  61. capabilities:
  62. add:
  63. - CHOWN
  64. - DAC_OVERRIDE
  65. - FOWNER
  66. - SETGID
  67. - SETUID
  68. command:
  69. - python
  70. args:
  71. - -c
  72. - |
  73. from deluge.config import Config
  74. import os
  75. import shutil
  76. if not os.path.exists('/config/core.conf'):
  77. print('Copying default config')
  78. shutil.copyfile('/defaults/core.conf', '/config/core.conf')
  79. print('Loading config')
  80. config = Config('/config/core.conf')
  81. print('Setting listen ports to {{ .Values.delugeNetwork.torrentPort }}')
  82. config['listen_ports'] = [{{ .Values.delugeNetwork.torrentPort }}, {{ .Values.delugeNetwork.torrentPort }}]
  83. print('Saving config')
  84. Config.save(config)
  85. print('Done')
  86. {{- end -}}