Skip to content

Commit ea92802

Browse files
committed
refactor(chart): rename frontend ConfigMap and add config.json key
- Rename configmap-caddy.yaml to configmap.yaml (generic frontend ConfigMap) - Update helper from *-frontend-caddy to *-frontend - Add showcase.frontend.config (YAML) rendered as config.json in ConfigMap - Mount config.json to /srv{baseRoute}/config.json in frontend deployment - Rename volume from 'caddyfile' to 'frontend-config' Signed-off-by: Emiliano Suñé <2395873+esune@users.noreply.github.com>
1 parent ba169af commit ea92802

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

charts/showcase/templates/_helpers.tpl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,17 @@ Server env Secret name.
184184
{{- end }}
185185

186186
{{/*
187-
Frontend ConfigMap name (Caddyfile).
187+
Server ConfigMap name (keycloak.json).
188+
*/}}
189+
{{- define "showcase.server.configmapName" -}}
190+
{{- printf "%s-server" (include "showcase.fullname" .) }}
191+
{{- end }}
192+
193+
{{/*
194+
Frontend ConfigMap name (Caddyfile + config.json).
188195
*/}}
189196
{{- define "showcase.frontend.configmapName" -}}
190-
{{- printf "%s-frontend-caddy" (include "showcase.fullname" .) }}
197+
{{- printf "%s-frontend" (include "showcase.fullname" .) }}
191198
{{- end }}
192199

193200
{{/*

charts/showcase/templates/frontend/configmap-caddy.yaml renamed to charts/showcase/templates/frontend/configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ data:
1212
{{- else }}
1313
{{ tpl (.Files.Get "files/caddyfile.tpl") . | nindent 4 }}
1414
{{- end }}
15+
config.json: |
16+
{{- .Values.showcase.frontend.config | toJson | nindent 4 }}

charts/showcase/templates/frontend/deployment.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ spec:
5252
value: {{ .Values.showcase.insightsProjectId | quote }}
5353
{{- end }}
5454
volumeMounts:
55-
- name: caddyfile
55+
- name: frontend-config
5656
mountPath: /etc/caddy/Caddyfile
5757
subPath: Caddyfile
58+
- name: frontend-config
59+
mountPath: /srv{{ .Values.showcase.baseRoute }}/config.json
60+
subPath: config.json
5861
readinessProbe:
5962
httpGet:
6063
path: /health
@@ -65,7 +68,7 @@ spec:
6568
resources: {{- toYaml . | nindent 12 }}
6669
{{- end }}
6770
volumes:
68-
- name: caddyfile
71+
- name: frontend-config
6972
configMap:
7073
name: {{ include "showcase.frontend.configmapName" . }}
7174
{{- with .Values.showcase.frontend.nodeSelector }}

charts/showcase/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ showcase:
136136
replicaCount: 1
137137
## HTTP listen port for Caddy (Caddyfile site block, container, and Service must match).
138138
containerPort: 3000
139+
## Runtime config injected as /srv{baseRoute}/config.json via ConfigMap.
140+
## Specify as YAML here; the chart converts it to JSON automatically.
141+
config:
142+
keycloakUrl: "https://dev.loginproxy.gov.bc.ca"
143+
keycloakRealm: digitaltrust-citz
144+
keycloakClientId: showcase-admin
139145
## Caddy Content-Security-Policy header. Default is permissive for Vite/React + API/WS; tighten for production.
140146
contentSecurityPolicy: "default-src * data: blob: filesystem: 'unsafe-inline' 'unsafe-eval'"
141147
## Caddy reverse_proxy trusted_proxies: use private_ranges (RFC1918 + loopback) for typical K8s ingress → pod hops.

0 commit comments

Comments
 (0)