Skip to content

Commit b776e74

Browse files
committed
feat: 🎨 use cnpg secret name optional attribute
1 parent 686c541 commit b776e74

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

charts/dso-console/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: cpn-console
33
description: A Helm chart to deploy Cloud Pi Native Console
44
type: application
5-
version: 2.1.9
5+
version: 2.1.10
66
appVersion: 9.3.3
77
keywords: []
88
home: https://cloud-pi-native.fr

charts/dso-console/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cpn-console
22

3-
![Version: 2.1.9](https://img.shields.io/badge/Version-2.1.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 9.3.3](https://img.shields.io/badge/AppVersion-9.3.3-informational?style=flat-square)
3+
![Version: 2.1.10](https://img.shields.io/badge/Version-2.1.10-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 9.3.3](https://img.shields.io/badge/AppVersion-9.3.3-informational?style=flat-square)
44

55
A Helm chart to deploy Cloud Pi Native Console
66

@@ -135,6 +135,7 @@ A Helm chart to deploy Cloud Pi Native Console
135135
| global.keycloak.realm | string | `"cloud-pi-native"` | Name of the keycloak realm used for authentication. |
136136
| global.keycloak.redirectUri | string | `"https://console.dso.local"` | Keycloak redirect uri used with keycloak. |
137137
| global.keycloak.sessionSecret | string | `"a-very-strong-secret-with-more-than-32-char"` | Session secret used to store keycloak session for Console CPN client. |
138+
| global.postgresql.cnpgSecretName | string | `""` | Name of the secret to use to connect to external CNPG-managed DB |
138139
| global.postgresql.dbUrl | string | `""` | Postgres database connection string used to override computed db url, usefull if external database. # For postgres it should look like this "postgresql://db_user:db_password@db_service:db_port/db_name?schema=public" |
139140
| global.secrets | object | `{}` | Map of environment variables to inject into backend and frontend containers. |
140141
| imageCredentials.email | string | `""` | Email to pull images. |

charts/dso-console/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ Create image pull secret
3535
{{- end }}
3636
{{- end }}
3737

38+
{{/*
39+
Create postgresql DB url connexion
40+
*/}}
41+
{{- define "cpnConsole.dbUrlValue" }}
42+
{{- if .Values.global.postgresql.dbUrl }}
43+
{{- .Values.global.postgresql.dbUrl }}
44+
{{- else }}
45+
{{- printf "postgresql://%s:%s@%s-%s-hl:%s/%s?schema=public" .Values.postgresql.auth.username .Values.postgresql.auth.password .Release.Name .Values.postgresql.nameOverride (.Values.postgresql.primary.service.ports.postgresql | toString) .Values.postgresql.auth.database }}
46+
{{- end }}
47+
{{- end }}
48+
3849

3950
{{/*
4051
Create container environment variables from configmap

charts/dso-console/templates/server/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ spec:
9292
{{- toYaml .Values.server.envFrom | nindent 8 }}
9393
{{- end }}
9494
{{- if .Values.server.startupProbe.enabled }}
95-
{{- if .Values.cnpg.enabled }}
95+
{{- if .Values.global.postgresql.cnpgSecretName }}
9696
env:
9797
- name: DB_URL
9898
valueFrom:
9999
secretKeyRef:
100-
name: pg-cluster-console-app
100+
name: {{ .Values.global.postgresql.cnpgSecretName }}
101101
key: uri
102102
{{- end }}
103103
startupProbe:

charts/dso-console/templates/server/secret.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ metadata:
66
data:
77
SESSION_SECRET: {{ .Values.global.keycloak.sessionSecret | b64enc }}
88
KEYCLOAK_CLIENT_SECRET: {{ .Values.global.keycloak.clientSecrets.backend | b64enc }}
9-
DB_URL: {{ .Values.global.postgresql.dbUrl | default (printf "postgresql://%s:%s@%s-%s-hl:%s/%s?schema=public" .Values.postgresql.auth.username .Values.postgresql.auth.password .Release.Name .Values.postgresql.nameOverride (.Values.postgresql.primary.service.ports.postgresql | toString) .Values.postgresql.auth.database) | b64enc }}
9+
{{- if not .Values.global.postgresql.cnpgSecretName }}
10+
DB_URL: {{ include "cpnConsole.dbUrlValue" . | b64enc }}
11+
{{- end -}}
1012
{{- if .Values.global.secrets -}}
1113
{{- include "cpnConsole.secret" .Values.global | indent 2 }}
1214
{{- end -}}

charts/dso-console/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ global:
7474
# -- Whether or not to deploy the keycloak dev realm into a configmap named `keycloak-realm-dev`.
7575
devRealm: false
7676
postgresql:
77+
# -- Name of the secret to use to connect to external CNPG-managed DB
78+
cnpgSecretName: ""
7779
# -- Postgres database connection string used to override computed db url, usefull if external database.
7880
## For postgres it should look like this "postgresql://db_user:db_password@db_service:db_port/db_name?schema=public"
7981
dbUrl: ""

0 commit comments

Comments
 (0)