From c7a300b81e0cb6e071e8aa8c9a25de334507d839 Mon Sep 17 00:00:00 2001 From: Dmitry Dunaev Date: Fri, 2 Sep 2022 14:40:18 +0300 Subject: [PATCH] [WIFI-10069] Add: helm - wait-postgres init container Signed-off-by: Dmitry Dunaev --- helm/.gitignore | 2 ++ helm/templates/deployment.yaml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/helm/.gitignore b/helm/.gitignore index 1377554..488078d 100644 --- a/helm/.gitignore +++ b/helm/.gitignore @@ -1 +1,3 @@ *.swp +Chart.lock +charts/ diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 2e8157b..9db0b1f 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -1,4 +1,5 @@ {{- $root := . -}} +{{- $storageType := index .Values.configProperties "storage.type" -}} --- apiVersion: apps/v1 kind: Deployment @@ -46,6 +47,39 @@ spec: - -timeout - 600s +{{- if eq $storageType "postgresql" }} + - name: wait-postgres + image: "{{ .Values.images.owprov.repository }}:{{ .Values.images.owprov.tag }}" + imagePullPolicy: {{ .Values.images.owprov.pullPolicy }} + command: + - /wait-for-postgres.sh + - {{ index .Values.configProperties "storage.type.postgresql.host" }} + - echo + - "PostgreSQL is ready" + env: + - name: KUBERNETES_DEPLOYED + value: "{{ now }}" + {{- range $key, $value := .Values.public_env_variables }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + {{- range $key, $value := .Values.secret_env_variables }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ include "owprov.fullname" $root }}-env + key: {{ $key }} + {{- end }} + volumeMounts: + {{- range .Values.volumes.owprov }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} +{{- end }} + containers: - name: owprov