_vaultwarden.tpl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {{- define "vaultwarden.workload" -}}
  2. workload:
  3. vaultwarden:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.vaultwardenNetwork.hostNetwork }}
  9. containers:
  10. vaultwarden:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: {{ .Values.vaultwardenRunAs.user }}
  16. runAsGroup: {{ .Values.vaultwardenRunAs.group }}
  17. env:
  18. ROCKET_PORT: {{ .Values.vaultwardenNetwork.webPort }}
  19. WEBSOCKET_PORT: {{ .Values.vaultwardenNetwork.wsPort }}
  20. WEBSOCKET_ENABLED: {{ .Values.vaultwardenNetwork.wsEnabled }}
  21. DATABASE_URL:
  22. secretKeyRef:
  23. name: postgres-creds
  24. key: POSTGRES_URL
  25. {{ if .Values.vaultwardenConfig.adminToken }}
  26. ADMIN_TOKEN:
  27. secretKeyRef:
  28. name: vaultwarden
  29. key: ADMIN_TOKEN
  30. {{ end }}
  31. {{ if .Values.vaultwardenNetwork.certificateID }}
  32. ROCKET_TLS: '{certs="/certs/public.crt",key="/certs/private.key"}'
  33. {{ end }}
  34. {{ with .Values.vaultwardenNetwork.domain }}
  35. DOMAIN: {{ . }}
  36. {{ end }}
  37. {{ with .Values.vaultwardenConfig.additionalEnvs }}
  38. envList:
  39. {{ range $env := . }}
  40. - name: {{ $env.name }}
  41. value: {{ $env.value }}
  42. {{ end }}
  43. {{ end }}
  44. probes:
  45. liveness:
  46. enabled: true
  47. type: exec
  48. command: /healthcheck.sh
  49. readiness:
  50. enabled: true
  51. type: exec
  52. command: /healthcheck.sh
  53. startup:
  54. enabled: true
  55. type: exec
  56. command: /healthcheck.sh
  57. initContainers:
  58. {{- include "ix.v1.common.app.postgresWait" (dict "name" "postgres-wait"
  59. "secretName" "postgres-creds") | nindent 8 }}
  60. {{/* Service */}}
  61. service:
  62. vaultwarden:
  63. enabled: true
  64. primary: true
  65. type: NodePort
  66. targetSelector: vaultwarden
  67. ports:
  68. webui:
  69. enabled: true
  70. primary: true
  71. port: {{ .Values.vaultwardenNetwork.webPort }}
  72. nodePort: {{ .Values.vaultwardenNetwork.webPort }}
  73. targetSelector: vaultwarden
  74. ws:
  75. enabled: {{ .Values.vaultwardenNetwork.wsEnabled }}
  76. port: {{ .Values.vaultwardenNetwork.wsPort }}
  77. nodePort: {{ .Values.vaultwardenNetwork.wsPort }}
  78. targetSelector: vaultwarden
  79. {{/* Persistence */}}
  80. persistence:
  81. data:
  82. enabled: true
  83. {{- include "vaultwarden.storage.ci.migration" (dict "storage" .Values.vaultwardenStorage.data) }}
  84. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.vaultwardenStorage.data) | nindent 4 }}
  85. targetSelector:
  86. vaultwarden:
  87. vaultwarden:
  88. mountPath: /data
  89. {{- range $idx, $storage := .Values.vaultwardenStorage.additionalStorages }}
  90. {{ printf "vaultwarden-%v:" (int $idx) }}
  91. enabled: true
  92. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  93. targetSelector:
  94. vaultwarden:
  95. vaultwarden:
  96. mountPath: {{ $storage.mountPath }}
  97. {{- end }}
  98. {{- if .Values.vaultwardenNetwork.certificateID }}
  99. cert:
  100. enabled: true
  101. type: secret
  102. objectName: vaultwarden-cert
  103. defaultMode: "0600"
  104. items:
  105. - key: tls.key
  106. path: private.key
  107. - key: tls.crt
  108. path: public.crt
  109. targetSelector:
  110. vaultwarden:
  111. vaultwarden:
  112. mountPath: /certs
  113. readOnly: true
  114. scaleCertificate:
  115. vaultwarden-cert:
  116. enabled: true
  117. id: {{ .Values.vaultwardenNetwork.certificateID }}
  118. {{- end -}}
  119. {{- end -}}
  120. {{/* TODO: Remove on the next version bump, eg 1.1.0+ */}}
  121. {{- define "vaultwarden.storage.ci.migration" -}}
  122. {{- $storage := .storage -}}
  123. {{- if $storage.hostPath -}}
  124. {{- $_ := set $storage "hostPathConfig" dict -}}
  125. {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
  126. {{- end -}}
  127. {{- end -}}