From 2ab8ce743c216e2fae5678900325534b802829d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20L=C3=A9obal?= Date: Thu, 4 Jan 2024 16:11:22 +0100 Subject: [PATCH] Fix bugs in helm templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One in my PR, and one preexisting Signed-off-by: Olivier LĂ©obal --- charts/substra-backend/CHANGELOG.md | 1 + charts/substra-backend/UPGRADE.md | 2 +- charts/substra-backend/templates/_helpers.tpl | 4 ++-- charts/substra-backend/templates/rbac.yaml | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/charts/substra-backend/CHANGELOG.md b/charts/substra-backend/CHANGELOG.md index 3672bec84..4c9c6355d 100644 --- a/charts/substra-backend/CHANGELOG.md +++ b/charts/substra-backend/CHANGELOG.md @@ -7,6 +7,7 @@ - BREAKING: Remove ServiceAccount creation from `worker.rbac.create`, putting it in a new `worker.serviceAccount.create` option - BREAKING: Some options that would result in service account names defaulting to "default" now raise an error at rendering time. Set the name to "default" by hand to reproduce the old behavior. - Add a new `worker.serviceAccount.name` option +- Fix "api events" services using the "worker events" service account instead of the "api events" one ## [24.0.1] - 2023-12-15 diff --git a/charts/substra-backend/UPGRADE.md b/charts/substra-backend/UPGRADE.md index fce129157..d30686720 100644 --- a/charts/substra-backend/UPGRADE.md +++ b/charts/substra-backend/UPGRADE.md @@ -1,6 +1,6 @@ ## unreleased -## 24.0.0 +## 25.0.0 If you have set `worker.rbac.create=false`, you now need to also set `worker.serviceAccount.create=false` to preserve the same behavior. diff --git a/charts/substra-backend/templates/_helpers.tpl b/charts/substra-backend/templates/_helpers.tpl index 8a0926e5c..77e187e97 100644 --- a/charts/substra-backend/templates/_helpers.tpl +++ b/charts/substra-backend/templates/_helpers.tpl @@ -146,7 +146,7 @@ Return the user list */}} {{- define "substra.worker.serviceAccountName" -}} {{- if .Values.worker.serviceAccount.create -}} - {{ default (printf "%s-event" ( include "substra.fullname" .)) .Values.worker.serviceAccount.name }} + {{ default (printf "%s-worker" ( include "substra.fullname" .)) .Values.worker.serviceAccount.name }} {{- else -}} {{- if .Values.worker.serviceAccount.name -}} {{ .Values.worker.serviceAccount.name }} @@ -176,7 +176,7 @@ Return the user list */}} {{- define "substra.api.events.serviceAccountName" -}} {{- if .Values.api.events.serviceAccount.create -}} - {{ default (printf "%s-event" ( include "substra.fullname" .)) .Values.api.events.serviceAccount.name }} + {{ default (printf "%s-api-event" ( include "substra.fullname" .)) .Values.api.events.serviceAccount.name }} {{- else -}} {{- if .Values.api.events.serviceAccount.name -}} {{ .Values.api.events.serviceAccount.name }} diff --git a/charts/substra-backend/templates/rbac.yaml b/charts/substra-backend/templates/rbac.yaml index d1a22f57d..19d01d577 100644 --- a/charts/substra-backend/templates/rbac.yaml +++ b/charts/substra-backend/templates/rbac.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "substra.fullname" . }}-worker + name: {{ include "substra.worker.serviceAccountName" . }} labels: {{ include "substra.labels" . | nindent 4 }} app.kubernetes.io/name: {{ template "substra.name" . }} @@ -60,7 +60,7 @@ roleRef: apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "substra.fullname" . }}-event + name: {{ include "substra.worker.events.serviceAccountName" . }} labels: {{ include "substra.labels" . | nindent 4 }} app.kubernetes.io/name: {{ template "substra.name" . }} @@ -112,7 +112,7 @@ metadata: kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: {{ template "substra.fullname" . }}-api-event + name: {{ include "substra.api.events.serviceAccountName" . }} labels: {{ include "substra.labels" . | nindent 4 }} app.kubernetes.io/name: {{ template "substra.name" . }}