postgres-deployment.yaml 1.4 KB

123456789101112131415161718192021222324
  1. {{ $values := (. | mustDeepCopy) }}
  2. {{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
  3. {{ include "common.deployment.common_config" $values | nindent 0 }}
  4. spec: {{ include "common.deployment.common_spec" $values | nindent 2 }}
  5. template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}
  6. spec:
  7. hostNetwork: {{ .Values.hostNetwork }}
  8. containers:
  9. - name: {{ .Chart.Name }}-postgres
  10. image: {{ template "postgres.imageName" . }}
  11. imagePullPolicy: {{ .Values.image.pullPolicy }}
  12. env:
  13. {{ $envList := (default list .Values.environmentVariables) }}
  14. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
  15. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user")}}
  16. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password")}}
  17. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
  18. volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
  19. ports:
  20. - name: postgres-tcp
  21. containerPort: 5432
  22. protocol: TCP
  23. volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}