_persistence.tpl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {{- define "n8n.persistence" -}}
  2. persistence:
  3. data:
  4. enabled: true
  5. {{- include "n8n.storage.ci.migration" (dict "storage" .Values.n8nStorage.data) }}
  6. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.n8nStorage.data) | nindent 4 }}
  7. targetSelector:
  8. n8n:
  9. n8n:
  10. mountPath: /data
  11. tmp:
  12. enabled: true
  13. type: emptyDir
  14. targetSelector:
  15. n8n:
  16. n8n:
  17. mountPath: /tmp
  18. {{- range $idx, $storage := .Values.n8nStorage.additionalStorages }}
  19. {{ printf "n8n-%v:" (int $idx) }}
  20. enabled: true
  21. {{- include "n8n.storage.ci.migration" (dict "storage" $storage) }}
  22. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  23. targetSelector:
  24. n8n:
  25. n8n:
  26. mountPath: {{ $storage.mountPath }}
  27. {{- end }}
  28. {{- include "n8n.storage.ci.migration" (dict "storage" .Values.n8nStorage.pgData) }}
  29. {{- include "n8n.storage.ci.migration" (dict "storage" .Values.n8nStorage.pgBackup) }}
  30. {{- include "ix.v1.common.app.postgresPersistence"
  31. (dict "pgData" .Values.n8nStorage.pgData
  32. "pgBackup" .Values.n8nStorage.pgBackup
  33. ) | nindent 2 }}
  34. {{- if .Values.n8nNetwork.certificateID }}
  35. cert:
  36. enabled: true
  37. type: secret
  38. objectName: n8n-cert
  39. defaultMode: "0600"
  40. items:
  41. - key: tls.key
  42. path: tls.key
  43. - key: tls.crt
  44. path: tls.crt
  45. targetSelector:
  46. n8n:
  47. n8n:
  48. mountPath: /certs
  49. readOnly: true
  50. scaleCertificate:
  51. n8n-cert:
  52. enabled: true
  53. id: {{ .Values.n8nNetwork.certificateID }}
  54. {{- end }}
  55. {{- end -}}
  56. {{/* TODO: Remove on the next version bump, eg 1.2.0+ */}}
  57. {{- define "n8n.storage.ci.migration" -}}
  58. {{- $storage := .storage -}}
  59. {{- if $storage.hostPath -}}
  60. {{- $_ := set $storage "hostPathConfig" dict -}}
  61. {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
  62. {{- end -}}
  63. {{- end -}}