_certContainer.tpl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{- define "syncthing.certContainer" -}}
  2. 01-certs:
  3. enabled: true
  4. type: init
  5. imageSelector: image
  6. securityContext:
  7. runAsUser: 0
  8. runAsGroup: 0
  9. runAsNonRoot: false
  10. readOnlyRootFilesystem: false
  11. allowPrivilegeEscalation: true
  12. capabilities:
  13. add:
  14. - FOWNER
  15. - DAC_OVERRIDE
  16. - CHOWN
  17. - SETUID
  18. - SETGID
  19. - SETFCAP
  20. - SETPCAP
  21. fixedEnv:
  22. PUID: {{ .Values.syncthingID.user }}
  23. command:
  24. - /bin/sh
  25. - -c
  26. - |
  27. #!/bin/sh
  28. set -e
  29. configDir=/var/syncthing/config
  30. # Copy certificates, so that syncthing can use them
  31. # If we mount the certificates directly, syncthing will not start, as it tries
  32. # to chmod the whole directory and fails, because the secret is read-only
  33. if [ ! -d "$configDir" ]; then
  34. mkdir -p "$configDir"
  35. chown -R "$PUID:$PGID" "$configDir"
  36. fi
  37. cp /certs/https-key.pem "$configDir/https-key.pem"
  38. cp /certs/https-cert.pem "$configDir/https-cert.pem"
  39. chown "$PUID:$PGID" "$configDir/https-key.pem"
  40. chown "$PUID:$PGID" "$configDir/https-cert.pem"
  41. {{- end -}}