From 85d797d3a1818c4de75c986be69571253927ee37 Mon Sep 17 00:00:00 2001 From: Kaan Yagci <9104546+kaanyagci@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:33:58 +0200 Subject: [PATCH] refactor(helm): refactor wait-minio (#755) `wait-minio` inside of `initContainer` moved to the helm helper templates Signed-off-by: Kaan Yagci --- charts/substra-backend/CHANGELOG.md | 6 ++++++ charts/substra-backend/Chart.yaml | 2 +- charts/substra-backend/templates/_helpers.tpl | 10 ++++++++++ .../substra-backend/templates/deployment-server.yaml | 4 +--- .../substra-backend/templates/statefulset-worker.yaml | 4 +--- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/charts/substra-backend/CHANGELOG.md b/charts/substra-backend/CHANGELOG.md index 6b01aaca1..68cbb44f0 100644 --- a/charts/substra-backend/CHANGELOG.md +++ b/charts/substra-backend/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [22.8.4] - 2023-10-06 + +## Changed + +- `wait-minio` container definition moved to the Helm helper templates + ## [22.8.3] - 2023-10-06 ### Changed diff --git a/charts/substra-backend/Chart.yaml b/charts/substra-backend/Chart.yaml index 25d1b8812..f64c36947 100644 --- a/charts/substra-backend/Chart.yaml +++ b/charts/substra-backend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: substra-backend home: https://github.com/Substra -version: 22.8.3 +version: 22.8.4 appVersion: 0.42.1 kubeVersion: ">= 1.19.0-0" description: Main package for Substra diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index 69d62e468..570fa98c8 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -194,4 +194,14 @@ The hostname we should connect to (external is defined, otherwise integrated) {{- else }} {{- template "postgresql.primary.fullname" .Subcharts.postgresql }}.{{ .Release.Namespace }} {{- end }} +{{- end -}} + + +{{/* +`wait-minio` container initialisation used inside of `initContainers` +*/}} +{{- define "common.waitMinIOContainer" -}} +- name: wait-minio + image: jwilder/dockerize:0.6.1 + command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000'] {{- end -}} \ No newline at end of file diff --git a/charts/substra-backend/templates/deployment-server.yaml b/charts/substra-backend/templates/deployment-server.yaml index 45a3ab58a..3ca64152b 100644 --- a/charts/substra-backend/templates/deployment-server.yaml +++ b/charts/substra-backend/templates/deployment-server.yaml @@ -191,9 +191,7 @@ spec: - name: wait-postgresql image: jwilder/dockerize:0.6.1 command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}'] - - name: wait-minio - image: jwilder/dockerize:0.6.1 - command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000'] + {{- include "common.waitMinIOContainer" . | nindent 6 }} - name: init-migrate image: {{ include "substra-backend.images.name" (dict "img" .Values.server.image "defaultTag" $.Chart.AppVersion) }} command: ['python', 'manage.py', 'migrate'] diff --git a/charts/substra-backend/templates/statefulset-worker.yaml b/charts/substra-backend/templates/statefulset-worker.yaml index 05efc9b61..e2e8fc0fe 100644 --- a/charts/substra-backend/templates/statefulset-worker.yaml +++ b/charts/substra-backend/templates/statefulset-worker.yaml @@ -100,9 +100,7 @@ spec: - name: wait-postgresql image: jwilder/dockerize:0.6.1 command: ['dockerize', '-wait', 'tcp://{{ template "substra-backend.database.host" . }}:{{ .Values.database.port }}'] - - name: wait-minio - image: jwilder/dockerize:0.6.1 - command: ['dockerize', '-wait', 'tcp://{{ .Release.Name }}-minio:9000'] + {{- include "common.waitMinIOContainer" . | nindent 6}} containers: - name: worker image: {{ include "substra-backend.images.name" (dict "img" .Values.worker.image "defaultTag" $.Chart.AppVersion) }}