From d83aa1865985f52d13c656280ff03558df8be365 Mon Sep 17 00:00:00 2001 From: Dmitry Dunaev Date: Fri, 2 Sep 2022 14:51:37 +0300 Subject: [PATCH] [WIFI-10069] Add: helm - wait-postgres init container Signed-off-by: Dmitry Dunaev --- .gitignore | 3 --- helm/.gitignore | 2 ++ helm/Chart.lock | 2 +- helm/templates/deployment.yaml | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f1d4526..97eaa5b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,9 +34,6 @@ # Generated version info src/ow_version.h -*.swp -helm/charts/* -!helm/charts/.gitkeep test_scripts/curl/result.json test_scripts/curl/token_sub.json test_scripts/curl/token_sec.json 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/Chart.lock b/helm/Chart.lock index c074d53..fb09181 100644 --- a/helm/Chart.lock +++ b/helm/Chart.lock @@ -9,4 +9,4 @@ dependencies: repository: https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/ version: 9.4.2 digest: sha256:e9df5a5d8a0a193bfda33ea06060203aace01f0f7df9eda662a84185322c7ab5 -generated: "2022-06-03T19:37:46.744676383+03:00" +generated: "2022-09-02T14:47:01.533833207+03:00" diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 435c091..547698d 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.owsub.repository }}:{{ .Values.images.owsub.tag }}" + imagePullPolicy: {{ .Values.images.owsub.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 "owsub.fullname" $root }}-env + key: {{ $key }} + {{- end }} + volumeMounts: + {{- range .Values.volumes.owsub }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} +{{- end }} + containers: - name: owsub