postgres-deployment.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {{ if .Values.logsearchapi.enabled }}
  2. {{ $values := (. | mustDeepCopy) }}
  3. {{ $_ := set $values "common" (dict "nameSuffix" (printf "%s-pg" (include "postgres.nameSuffix" .))) }}
  4. {{ include "common.deployment.common_config" $values | nindent 0 }}
  5. spec:
  6. replicas: {{ (default 1 .Values.replicas) }}
  7. strategy:
  8. type: Recreate
  9. selector:
  10. matchLabels:
  11. app.kubernetes.io/name: {{ template "common.names.name" $values }}
  12. app.kubernetes.io/instance: {{ .Release.Name }}-postgres-pg
  13. app: {{ template "common.names.name" . }}
  14. release: {{ .Release.Name }}
  15. template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}
  16. spec:
  17. containers:
  18. - name: {{ .Chart.Name }}-{{ include "postgres.nameSuffix" .}}
  19. image: {{ template "postgres.imageName" . }}
  20. imagePullPolicy: {{ .Values.image.pullPolicy }}
  21. env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
  22. volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
  23. ports:
  24. - name: postgres-tcp
  25. containerPort: 5432
  26. protocol: TCP
  27. readinessProbe:
  28. exec:
  29. command:
  30. - sh
  31. - -c
  32. - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done"
  33. initialDelaySeconds: 15
  34. failureThreshold: 5
  35. periodSeconds: 15
  36. timeoutSeconds: 2
  37. livenessProbe:
  38. exec:
  39. command:
  40. - sh
  41. - -c
  42. - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done"
  43. initialDelaySeconds: 15
  44. failureThreshold: 5
  45. periodSeconds: 15
  46. timeoutSeconds: 2
  47. startupProbe:
  48. exec:
  49. command:
  50. - sh
  51. - -c
  52. - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done"
  53. initialDelaySeconds: 15
  54. failureThreshold: 20
  55. periodSeconds: 15
  56. timeoutSeconds: 2
  57. volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
  58. {{ end }}