postgres-deployment.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_PASSWORD
  32. valueFrom:
  33. secretKeyRef:
  34. name: db-details
  35. key: db-password
  36. volumeMounts:
  37. - name: postgres-data
  38. mountPath: /var/lib/postgresql/data
  39. - name: postgres-backup
  40. mountPath: /postgres_backups
  41. ports:
  42. - name: postgres-tcp
  43. containerPort: 5432
  44. protocol: TCP
  45. volumes:
  46. - name: postgres-data
  47. hostPath:
  48. path: {{ template "configuredPostgresHostPath" . }}
  49. - name: postgres-backup
  50. hostPath:
  51. path: {{ template "configuredBackupPostgresHostPath" . }}