postgres-deployment.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{ $values := . }}
  2. {{ $_ := set $values "nameSuffix" "postgres" }}
  3. apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
  4. kind: Deployment
  5. metadata:
  6. name: {{ template "common.names.fullname" $values }}
  7. labels: {{ include "common.labels.selectorLabels" $values | nindent 4 }}
  8. spec:
  9. replicas: 1
  10. strategy:
  11. type: {{ .Values.nextcloud.strategy }}
  12. selector:
  13. matchLabels: {{- include "common.labels.selectorLabels" $values | nindent 6 }}
  14. template:
  15. metadata:
  16. labels: {{- include "common.labels.selectorLabels" $values | nindent 8 }}
  17. annotations: {{- include "common.annotations" $values | nindent 8 }}
  18. spec:
  19. containers:
  20. - name: {{ .Chart.Name }}-postgres
  21. image: {{ template "postgres.imageName" . }}
  22. imagePullPolicy: {{ .Values.image.pullPolicy }}
  23. env:
  24. {{ $envList := list }}
  25. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
  26. {{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
  27. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
  28. volumeMounts:
  29. - name: postgres-data
  30. mountPath: /var/lib/postgresql/data
  31. - name: postgres-backup
  32. mountPath: /postgres_backups
  33. ports:
  34. - name: postgres-tcp
  35. containerPort: 5432
  36. protocol: TCP
  37. volumes:
  38. {{ $vols := list }}
  39. {{ $vols = mustAppend $vols (dict "name" "postgres-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresDataVolume | default dict).datasetName ) }}
  40. {{ $vols = mustAppend $vols (dict "name" "postgres-backup" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresBackupVolume | default dict).datasetName ) }}
  41. {{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8 }}