diff --git a/charts/dso-console/README.md b/charts/dso-console/README.md index 8c97319..dedfabe 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 | 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/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..91e87f1 100644 --- a/charts/dso-console/values.yaml +++ b/charts/dso-console/values.yaml @@ -48,6 +48,12 @@ global: # -- Map of environment variables to inject into backend and frontend containers. env: NODE_ENV: "production" + + + 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.