From 0c16e06b610dc42b0cf26f702664181602e65385 Mon Sep 17 00:00:00 2001 From: Baptiste Noleau Date: Fri, 21 Jun 2024 11:59:19 +0200 Subject: [PATCH 1/3] wip --- charts/dso-console/templates/_helpers.tpl | 17 +++++++++++++++++ .../templates/client/deployment.yaml | 5 +---- .../templates/server/deployment.yaml | 5 +---- charts/dso-console/values.yaml | 3 +++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/charts/dso-console/templates/_helpers.tpl b/charts/dso-console/templates/_helpers.tpl index 7929963..add0380 100644 --- a/charts/dso-console/templates/_helpers.tpl +++ b/charts/dso-console/templates/_helpers.tpl @@ -35,6 +35,23 @@ Create image pull secret {{- end }} {{- end }} +{{/* +Define image pull secret properties +*/}} +{{- define "cpnConsole.renderImagePullSecrets" }} +{{- $hasImagePullSecrets := (or (not (empty .Values.global.imagePullSecrets)) (and .Values.imageCredentials.username .Values.imageCredentials.password) ) }} +{{- if $hasImagePullSecrets }} +imagePullSecrets: +{{- if (and .Values.imageCredentials.username .Values.imageCredentials.password) }} +{{- $secretName := printf "%s-pullsecret" (include "cpnConsole.name" .)}} +- name: {{ $secretName }} +{{- end }} +{{- range .Values.global.imagePullSecrets | uniq }} +- name: {{ . }} +{{- end -}} +{{- end }} +{{- end }} + {{/* Create container environment variables from configmap diff --git a/charts/dso-console/templates/client/deployment.yaml b/charts/dso-console/templates/client/deployment.yaml index 209f461..4bc3a88 100644 --- a/charts/dso-console/templates/client/deployment.yaml +++ b/charts/dso-console/templates/client/deployment.yaml @@ -27,10 +27,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- if and .Values.imageCredentials.username .Values.imageCredentials.password }} - imagePullSecrets: - - name: {{ include "cpnConsole.name" . }}-pullsecret - {{- end }} + {{ include "cpnConsole.renderImagePullSecrets" . | nindent 6 }} securityContext: {{- toYaml .Values.client.podSecurityContext | nindent 8 }} {{- if .Values.client.initContainers }} diff --git a/charts/dso-console/templates/server/deployment.yaml b/charts/dso-console/templates/server/deployment.yaml index e8cf520..7510ed5 100644 --- a/charts/dso-console/templates/server/deployment.yaml +++ b/charts/dso-console/templates/server/deployment.yaml @@ -28,10 +28,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- if and .Values.imageCredentials.username .Values.imageCredentials.password }} - imagePullSecrets: - - name: {{ include "cpnConsole.name" . }}-pullsecret - {{- end }} + {{ include "cpnConsole.renderImagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "cpnConsole.server.serviceAccountName" . }} securityContext: {{- toYaml .Values.server.podSecurityContext | nindent 8 }} diff --git a/charts/dso-console/values.yaml b/charts/dso-console/values.yaml index cb18f8a..d1cd208 100644 --- a/charts/dso-console/values.yaml +++ b/charts/dso-console/values.yaml @@ -49,6 +49,9 @@ global: env: NODE_ENV: "production" # -- Map of environment variables to inject into backend and frontend containers. + imagePullSecrets: [] + # imagePullSecrets: + # - name: my-pull-secret secrets: {} ## Global informations about the Keycloak instance that will be shared to the server and client. keycloak: From ebae4117a44882c9caba7672ac2a2e630198258f Mon Sep 17 00:00:00 2001 From: Baptiste Noleau Date: Fri, 21 Jun 2024 12:02:29 +0200 Subject: [PATCH 2/3] add doc --- charts/dso-console/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/dso-console/README.md b/charts/dso-console/README.md index 8c97319..599956d 100644 --- a/charts/dso-console/README.md +++ b/charts/dso-console/README.md @@ -109,6 +109,7 @@ A Helm chart to deploy Cloud Pi Native Console | config.secrets | object | `{}` | Secrets to inject into the configuration. It is needed for server to get services informations such as urls, admin username, admin password or token, etc. | | fullnameOverride | string | `""` | String to fully override the default application name. | | global.env | object | `{"NODE_ENV":"production"}` | Map of environment variables to inject into backend and frontend containers. | +| global.imagePullSecrets | array | Global Docker registry secret names as an array | global.keycloak.clientIds.backend | string | `"console-backend"` | Keycloak clientId used for Console CPN client. | | global.keycloak.clientIds.frontend | string | `"console-frontend"` | Keycloak clientId used for frontend. | | global.keycloak.clientSecrets.backend | string | `""` | Keycloak clientSecret used for Console CPN client. | From be3a0738d789094632373473dc7ebec1d693a58d Mon Sep 17 00:00:00 2001 From: Baptiste Noleau Date: Fri, 21 Jun 2024 13:04:31 +0200 Subject: [PATCH 3/3] fix --- charts/dso-console/README.md | 2 +- charts/dso-console/values.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/charts/dso-console/README.md b/charts/dso-console/README.md index 599956d..dedfabe 100644 --- a/charts/dso-console/README.md +++ b/charts/dso-console/README.md @@ -109,7 +109,7 @@ A Helm chart to deploy Cloud Pi Native Console | config.secrets | object | `{}` | Secrets to inject into the configuration. It is needed for server to get services informations such as urls, admin username, admin password or token, etc. | | fullnameOverride | string | `""` | String to fully override the default application name. | | global.env | object | `{"NODE_ENV":"production"}` | Map of environment variables to inject into backend and frontend containers. | -| global.imagePullSecrets | array | Global Docker registry secret names as an array +| global.imagePullSecrets | list | `[]` | | | global.keycloak.clientIds.backend | string | `"console-backend"` | Keycloak clientId used for Console CPN client. | | global.keycloak.clientIds.frontend | string | `"console-frontend"` | Keycloak clientId used for frontend. | | global.keycloak.clientSecrets.backend | string | `""` | Keycloak clientSecret used for Console CPN client. | diff --git a/charts/dso-console/values.yaml b/charts/dso-console/values.yaml index d1cd208..91e87f1 100644 --- a/charts/dso-console/values.yaml +++ b/charts/dso-console/values.yaml @@ -48,10 +48,13 @@ global: # -- Map of environment variables to inject into backend and frontend containers. env: NODE_ENV: "production" - # -- Map of environment variables to inject into backend and frontend containers. + + imagePullSecrets: [] # imagePullSecrets: # - name: my-pull-secret + + # -- Map of environment variables to inject into backend and frontend containers. secrets: {} ## Global informations about the Keycloak instance that will be shared to the server and client. keycloak: