Files
charts/test/nextcloud/1.1.0/templates/postgres-deployment.yaml
T

42 lines
2.1 KiB
YAML

{{ $values := . }}
{{ $_ := set $values "nameSuffix" "postgres" }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "common.names.fullname" $values }}
labels: {{ include "common.labels.selectorLabels" $values | nindent 4 }}
spec:
replicas: 1
strategy:
type: {{ .Values.nextcloud.strategy }}
selector:
matchLabels: {{- include "common.labels.selectorLabels" $values | nindent 6 }}
template:
metadata:
labels: {{- include "common.labels.selectorLabels" $values | nindent 8 }}
annotations: {{- include "common.annotations" $values | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}-postgres
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{ $envList := list }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
- name: postgres-backup
mountPath: /postgres_backups
ports:
- name: postgres-tcp
containerPort: 5432
protocol: TCP
volumes:
{{ $vols := list }}
{{ $vols = mustAppend $vols (dict "name" "postgres-data" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresDataVolume | default dict).datasetName ) }}
{{ $vols = mustAppend $vols (dict "name" "postgres-backup" "emptyDirVolumes" .Values.emptyDirVolumes "hostPathEnabled" false "pathField" nil "datasetName" (.Values.postgresBackupVolume | default dict).datasetName ) }}
{{ include "common.storage.volumesConfiguration" (dict "ixVolumes" .Values.ixVolumes "volumes" $vols) | nindent 8 }}