From d83df67347aeea1595290ffb4266a18194b63550 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Wed, 2 Nov 2022 20:43:55 +0200 Subject: [PATCH] add postgres deployment --- charts/minio/1.7.0/templates/_postgres.tpl | 14 ++++++ .../1.7.0/templates/postgres-deployment.yaml | 47 +++++++++++++++++++ charts/minio/1.7.0/test_values.yaml | 14 ++++++ 3 files changed, 75 insertions(+) create mode 100644 charts/minio/1.7.0/templates/postgres-deployment.yaml diff --git a/charts/minio/1.7.0/templates/_postgres.tpl b/charts/minio/1.7.0/templates/_postgres.tpl index af26a05f6b..01be54d6ae 100644 --- a/charts/minio/1.7.0/templates/_postgres.tpl +++ b/charts/minio/1.7.0/templates/_postgres.tpl @@ -26,3 +26,17 @@ {{- $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "db_password") -}} {{- include "common.containers.environmentVariables" (dict "environmentVariables" $envList) -}} {{- end -}} + +{{/* +Retrieve postgres volume configuration +*/}} +{{- define "postgres.volumeConfiguration" -}} +{{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }} +{{- end -}} + +{{/* +Retrieve postgres volume mounts configuration +*/}} +{{- define "postgres.volumeMountsConfiguration" -}} +{{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresql ) | nindent 0 }} +{{- end -}} diff --git a/charts/minio/1.7.0/templates/postgres-deployment.yaml b/charts/minio/1.7.0/templates/postgres-deployment.yaml new file mode 100644 index 0000000000..22d5c28d37 --- /dev/null +++ b/charts/minio/1.7.0/templates/postgres-deployment.yaml @@ -0,0 +1,47 @@ +{{ $values := (. | mustDeepCopy) }} +{{ $_ := set $values "common" (dict "nameSuffix" (include "postgres.nameSuffix" .)) }} +{{ include "common.deployment.common_config" $values | nindent 0 }} +spec: {{ include "common.deployment.common_spec" $values | nindent 2 }} + template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }} + spec: + containers: + - name: {{ .Chart.Name }}-{{ include "postgres.nameSuffix" .}} + image: {{ template "postgres.imageName" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }} + volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }} + ports: + - name: postgres-tcp + containerPort: 5432 + protocol: TCP + readinessProbe: + exec: + command: + - sh + - -c + - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done" + initialDelaySeconds: 15 + failureThreshold: 5 + periodSeconds: 15 + timeoutSeconds: 2 + livenessProbe: + exec: + command: + - sh + - -c + - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done" + initialDelaySeconds: 15 + failureThreshold: 5 + periodSeconds: 15 + timeoutSeconds: 2 + startupProbe: + exec: + command: + - sh + - -c + - "until pg_isready -U${POSTGRES_USER} -h localhost; do sleep 2; done" + initialDelaySeconds: 15 + failureThreshold: 20 + periodSeconds: 15 + timeoutSeconds: 2 + volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }} diff --git a/charts/minio/1.7.0/test_values.yaml b/charts/minio/1.7.0/test_values.yaml index c519bdcee0..47c5943db1 100644 --- a/charts/minio/1.7.0/test_values.yaml +++ b/charts/minio/1.7.0/test_values.yaml @@ -2,6 +2,20 @@ appVolumeMounts: export: emptyDir: true mountPath: /export +postgresAppVolumeMounts: + postgres-backup: + emptyDir: true + mountPath: /postgres_backups + postgres-data: + emptyDir: true + mountPath: /var/lib/postgresql/data +postgresql: + backupVolume: + datasetName: ix-postgres_backups + mountPath: /postgres_backups + dataVolume: + datasetName: ix-postgres_data + mountPath: /var/lib/postgresql/data distributedIps: [] distributedMode: false dnsConfig: