postgres-deployment.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{ $values := (. | mustDeepCopy) }}
  2. {{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
  3. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  4. kind: Deployment
  5. metadata:
  6. name: {{ template "common.names.fullname" . }}-postgres-nc
  7. labels:
  8. app.kubernetes.io/name: {{ template "common.names.name" . }}-postgres
  9. app.kubernetes.io/instance: {{ .Release.Name }}-postgres
  10. spec:
  11. strategy:
  12. type: "Recreate"
  13. selector:
  14. matchLabels:
  15. app.kubernetes.io/name: {{ template "common.names.name" . }}-postgres
  16. app.kubernetes.io/instance: {{ .Release.Name }}-postgres
  17. template:
  18. metadata:
  19. name: {{ template "common.names.fullname" . }}
  20. labels:
  21. app.kubernetes.io/name: {{ template "common.names.name" . }}-postgres
  22. app.kubernetes.io/instance: {{ .Release.Name }}-postgres
  23. annotations: {{ include "common.annotations" . | nindent 8 }}
  24. spec:
  25. containers:
  26. - name: {{ .Chart.Name }}-postgres
  27. image: {{ template "postgres.imageName" . }}
  28. imagePullPolicy: {{ .Values.image.pullPolicy }}
  29. env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
  30. volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
  31. ports:
  32. - name: postgres-tcp
  33. containerPort: 5432
  34. protocol: TCP
  35. readinessProbe:
  36. exec:
  37. command:
  38. - sh
  39. - -c
  40. - "until pg_isready -U ${POSTGRES_USER} -h localhost; do sleep 2; done"
  41. initialDelaySeconds: 10
  42. periodSeconds: 10
  43. timeoutSeconds: 5
  44. failureThreshold: 5
  45. successThreshold: 2
  46. livenessProbe:
  47. exec:
  48. command:
  49. - sh
  50. - -c
  51. - "until pg_isready -U ${POSTGRES_USER} -h localhost; do sleep 2; done"
  52. initialDelaySeconds: 10
  53. periodSeconds: 10
  54. timeoutSeconds: 5
  55. failureThreshold: 5
  56. successThreshold: 1
  57. startupProbe:
  58. exec:
  59. command:
  60. - sh
  61. - -c
  62. - "until pg_isready -U ${POSTGRES_USER} -h localhost; do sleep 2; done"
  63. initialDelaySeconds: 10
  64. periodSeconds: 5
  65. timeoutSeconds: 2
  66. failureThreshold: 60
  67. successThreshold: 1
  68. volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}