From ee8fa99ea7eaadd96be32554af7f3cc2aa86a3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 11:00:59 +0200 Subject: [PATCH 1/6] feat: add `common.waitRedisInitContainer` template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/templates/_helpers.tpl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index e2abe464f..61fb76b4e 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -254,6 +254,20 @@ The hostname we should connect to (external is defined, otherwise integrated) {{- end }} {{- end -}} +{{- define "common.waitRedisInitContainer" -}} +{{- if .Values.redis.enabled }} +- name: wait-redis + image: jwilder/dockerize:0.6.1 + securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + capabilities: + drop: ["ALL"] + command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '15s'] +{{- end }} +{{- end -}} {{/* `wait-postgresql` container initialisation used inside of `initContainers` From e4bbdb3fb38a48a4aeeb93bbfd0a6c3e12d8be84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 11:01:42 +0200 Subject: [PATCH 2/6] chore: add `common.waitRedisInitContainer` to resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/templates/deployment-api-events.yaml | 1 + .../substra-backend/templates/deployment-scheduler-worker.yaml | 1 + charts/substra-backend/templates/deployment-scheduler.yaml | 2 ++ charts/substra-backend/templates/deployment-server.yaml | 1 + charts/substra-backend/templates/deployment-worker-events.yaml | 1 + charts/substra-backend/templates/statefulset-builder.yaml | 1 + 6 files changed, 7 insertions(+) diff --git a/charts/substra-backend/templates/deployment-api-events.yaml b/charts/substra-backend/templates/deployment-api-events.yaml index 459b7e8f7..6a55736e9 100644 --- a/charts/substra-backend/templates/deployment-api-events.yaml +++ b/charts/substra-backend/templates/deployment-api-events.yaml @@ -109,6 +109,7 @@ spec: {{- include "common.addCertInitContainer" . | nindent 8 }} {{- include "common.waitPostgresqlInitContainer" . | nindent 8 }} {{- include "common.waitInitMigrationsInitContainer" . | nindent 8}} + {{- include "common.waitRedisInitContainer" . | nindent 8 }} volumes: - name: volume-wait-init-migrations configMap: diff --git a/charts/substra-backend/templates/deployment-scheduler-worker.yaml b/charts/substra-backend/templates/deployment-scheduler-worker.yaml index 0c1bf6e94..2bb36a3c1 100644 --- a/charts/substra-backend/templates/deployment-scheduler-worker.yaml +++ b/charts/substra-backend/templates/deployment-scheduler-worker.yaml @@ -98,6 +98,7 @@ spec: {{- toYaml .Values.schedulerWorker.resources | nindent 12 }} initContainers: {{- include "common.addCertInitContainer" . | nindent 8 }} + {{- include "common.waitRedisInitContainer" . | nindent 8 }} volumes: {{- if .Values.privateCa.enabled }} - name: ssl-certs diff --git a/charts/substra-backend/templates/deployment-scheduler.yaml b/charts/substra-backend/templates/deployment-scheduler.yaml index 068637dba..723d34823 100644 --- a/charts/substra-backend/templates/deployment-scheduler.yaml +++ b/charts/substra-backend/templates/deployment-scheduler.yaml @@ -99,6 +99,8 @@ spec: {{ end }} resources: {{- toYaml .Values.scheduler.resources | nindent 12 }} + initContainers: + {{- include "common.waitRedisInitContainer" . | nindent 8 }} volumes: - name: runtime-db emptyDir: {} diff --git a/charts/substra-backend/templates/deployment-server.yaml b/charts/substra-backend/templates/deployment-server.yaml index 8f4286725..c2f01112d 100644 --- a/charts/substra-backend/templates/deployment-server.yaml +++ b/charts/substra-backend/templates/deployment-server.yaml @@ -247,6 +247,7 @@ spec: - name: DJANGO_SETTINGS_MODULE value: backend.settings.{{ .Values.settings }} {{- include "common.waitMinIOContainer" . | nindent 6 }} + {{- include "common.waitRedisInitContainer" . | nindent 6 }} volumes: - name: data-servermedias persistentVolumeClaim: diff --git a/charts/substra-backend/templates/deployment-worker-events.yaml b/charts/substra-backend/templates/deployment-worker-events.yaml index 1bd6a8a21..ca7c49348 100644 --- a/charts/substra-backend/templates/deployment-worker-events.yaml +++ b/charts/substra-backend/templates/deployment-worker-events.yaml @@ -111,6 +111,7 @@ spec: {{- include "common.addCertInitContainer" . | nindent 8 }} {{- include "common.waitPostgresqlInitContainer" . | nindent 8 }} {{- include "common.waitInitMigrationsInitContainer" . | nindent 8}} + {{- include "common.waitRedisInitContainer" . | nindent 8 }} volumes: - name: volume-wait-init-migrations configMap: diff --git a/charts/substra-backend/templates/statefulset-builder.yaml b/charts/substra-backend/templates/statefulset-builder.yaml index 3f81b6d3d..584e7d4ec 100644 --- a/charts/substra-backend/templates/statefulset-builder.yaml +++ b/charts/substra-backend/templates/statefulset-builder.yaml @@ -68,6 +68,7 @@ spec: serviceAccountName: {{ template "substra.fullname" . }}-builder initContainers: {{- include "common.waitPostgresqlInitContainer" . | nindent 6 }} + {{- include "common.waitRedisInitContainer" . | nindent 6 }} {{- if .Values.privateCa.enabled }} - name: add-cert image: {{ include "common.images.name" .Values.privateCa.image }} From d4e71da03b42803322a5c7c969f8584f8c4b3562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 11:47:13 +0200 Subject: [PATCH 3/6] fix: change timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index 61fb76b4e..b506eb21b 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -265,7 +265,7 @@ The hostname we should connect to (external is defined, otherwise integrated) type: RuntimeDefault capabilities: drop: ["ALL"] - command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '15s'] + command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '60s'] {{- end }} {{- end -}} From 152fafd75e7b970b5e695d76de50ce3bb5b95413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 12:20:21 +0200 Subject: [PATCH 4/6] fix: change timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index b506eb21b..23f7497bf 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -265,7 +265,7 @@ The hostname we should connect to (external is defined, otherwise integrated) type: RuntimeDefault capabilities: drop: ["ALL"] - command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '60s'] + command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '120s'] {{- end }} {{- end -}} From 67ef382fef6a739d86a733cb88e469149c9f2c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 14:43:34 +0200 Subject: [PATCH 5/6] fix: change timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index 23f7497bf..76737d87a 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -265,7 +265,7 @@ The hostname we should connect to (external is defined, otherwise integrated) type: RuntimeDefault capabilities: drop: ["ALL"] - command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '120s'] + command: ['dockerize', '-wait', 'tcp://{{ default (include "redis.serviceName" .) .Values.redis.host }}:{{ .Values.redis.master.service.ports.redis }}', '-timeout', '5m'] {{- end }} {{- end -}} From 87bcede15b6f5e7536b9cfb2de5628bc811ceedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Wed, 9 Oct 2024 14:45:56 +0200 Subject: [PATCH 6/6] docs: changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- charts/substra-backend/CHANGELOG.md | 6 ++++++ charts/substra-backend/Chart.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/charts/substra-backend/CHANGELOG.md b/charts/substra-backend/CHANGELOG.md index 3f56da53a..05c3dac0d 100644 --- a/charts/substra-backend/CHANGELOG.md +++ b/charts/substra-backend/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog +## [26.14.0] - 2024-10-09 + +# Added + +Pods relying on redis uses a new init container `wait-redis` which wait for redis to be up before spawning + ## [26.13.0] - 2024-09-30 # Added diff --git a/charts/substra-backend/Chart.yaml b/charts/substra-backend/Chart.yaml index 7bd60b33b..83efc1002 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: 26.13.0 +version: 26.14.0 appVersion: 0.48.0 kubeVersion: '>= 1.19.0-0' description: Main package for Substra