Skip to content

Commit

Permalink
refactor(charts): Move wait-postgresql to Helm chart helper templates (
Browse files Browse the repository at this point in the history
…#753)

* refactor(charts): Move wait-postgresql to Helm chart helper templates

Signed-off-by: Kaan Yagci <kaan.yagci-ext@owkin.com>

* chore(charts): Chart version bumped to 22.8.3

Changelog updated

Signed-off-by: Kaan Yagci <kaan.yagci-ext@owkin.com>

* fix(changelog): typoe fixed in title

Signed-off-by: Kaan Yagci <kaan.yagci-ext@owkin.com>

* chore(helm): change wait-postgresql image with postgresql image

Signed-off-by: Kaan Yagci <kaan.yagci-ext@owkin.com>

---------

Signed-off-by: Kaan Yagci <kaan.yagci-ext@owkin.com>
  • Loading branch information
kaanyagci committed Oct 10, 2023
1 parent 85d797d commit 24c3703
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
6 changes: 6 additions & 0 deletions charts/substra-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [22.8.5] - 2023-10-09

### Changed

- initContainer `wait-postgresql` refactored to Helm Helper templates

## [22.8.4] - 2023-10-06

## Changed
Expand Down
2 changes: 1 addition & 1 deletion charts/substra-backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: substra-backend
home: https://github.com/Substra
version: 22.8.4
version: 22.8.5
appVersion: 0.42.1
kubeVersion: ">= 1.19.0-0"
description: Main package for Substra
Expand Down
10 changes: 10 additions & 0 deletions charts/substra-backend/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,14 @@ The hostname we should connect to (external is defined, otherwise integrated)
- name: wait-minio
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000']
{{- end -}}


{{/*
`wait-postgresql` container initialisation used inside of `initContainers`
*/}}
{{- define "common.waitPostgresqlInitContainer" -}}
- name: wait-postgresql
image: postgres
command: ['sh', '-c', 'until pg_isready --host={{ template "substra-backend.database.host" . }} --port={{ .Values.database.port }}; do echo "Waiting for postgresql service"; sleep 2; done;']
{{- end -}}
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/deployment-api-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 8 }}
- name: wait-init-migrations
image: {{ include "substra-backend.images.name" (dict "img" .Values.api.events.image "defaultTag" $.Chart.AppVersion) }}
command: ['bash', '/usr/src/app/wait-init-migration.sh']
Expand Down
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 6 }}
{{- include "common.waitMinIOContainer" . | nindent 6 }}
- name: init-migrate
image: {{ include "substra-backend.images.name" (dict "img" .Values.server.image "defaultTag" $.Chart.AppVersion) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ spec:
- mountPath: /tmp/certs/
name: ssl-certs
{{- end }}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 8 }}
- name: wait-init-migrations
image: {{ include "substra-backend.images.name" (dict "img" .Values.worker.events.image "defaultTag" $.Chart.AppVersion) }}
command: ['bash', '/usr/src/app/wait-init-migration.sh']
Expand Down
Empty file.
4 changes: 1 addition & 3 deletions charts/substra-backend/templates/statefulset-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ spec:
mountPath: /kaniko/.docker
{{- end }}
{{- end}}
- name: wait-postgresql
image: jwilder/dockerize:0.6.1
command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}']
{{- include "common.waitPostgresqlInitContainer" . | nindent 6 }}
{{- include "common.waitMinIOContainer" . | nindent 6}}
containers:
- name: worker
Expand Down

0 comments on commit 24c3703

Please sign in to comment.