postgres-deployment.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ template "nextcloud.fullname" . }}-postgres
  5. labels:
  6. helm.sh/chart: {{ include "nextcloud.chart" . }}
  7. {{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }}
  8. app.kubernetes.io/managed-by: {{ .Release.Service }}
  9. app.kubernetes.io/component: database
  10. spec:
  11. replicas: 1
  12. strategy:
  13. type: {{ .Values.nextcloud.strategy }}
  14. selector:
  15. matchLabels:
  16. {{- include "nextcloud.postgres.selectorLabels" . | nindent 6 }}
  17. app.kubernetes.io/component: database
  18. template:
  19. metadata:
  20. labels:
  21. {{- include "nextcloud.postgres.selectorLabels" . | nindent 8 }}
  22. app.kubernetes.io/component: database
  23. annotations:
  24. rollme: {{ randAlphaNum 5 | quote }}
  25. spec:
  26. containers:
  27. - name: {{ .Chart.Name }}-postgres
  28. image: "postgres:13.1"
  29. imagePullPolicy: {{ .Values.image.pullPolicy }}
  30. env:
  31. - name: POSTGRES_USER
  32. valueFrom:
  33. secretKeyRef:
  34. name: db-details
  35. key: db-user
  36. - name: POSTGRES_PASSWORD
  37. valueFrom:
  38. secretKeyRef:
  39. name: db-details
  40. key: db-password
  41. volumeMounts:
  42. - name: postgres-data
  43. mountPath: /var/lib/postgresql/data
  44. - name: postgres-backup
  45. mountPath: /postgres_backups
  46. ports:
  47. - name: postgres-tcp
  48. containerPort: 5432
  49. protocol: TCP
  50. volumes:
  51. - name: postgres-data
  52. {{- if ne (include "configuredPostgresHostPath" .) "" }}
  53. hostPath:
  54. path: {{ template "configuredPostgresHostPath" . }}
  55. {{- else }}
  56. emptyDir: {}
  57. {{- end }}
  58. - name: postgres-backup
  59. {{- if ne (include "configuredBackupPostgresHostPath" .) "" }}
  60. hostPath:
  61. path: {{ template "configuredBackupPostgresHostPath" . }}
  62. {{- else }}
  63. emptyDir: {}
  64. {{- end }}