Skip to content

Commit 16e20e9

Browse files
committed
✨(helm) allow to load custom theme file in a configMap
In order to load a custom theme file with our helm chart, we allow to load the content of a file into a config map and then use this configmap as a volume in the backend deployment
1 parent 76c2876 commit 16e20e9

File tree

7 files changed

+109
-77
lines changed

7 files changed

+109
-77
lines changed

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ RUN wget https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
8787
# Copy entrypoint
8888
COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
8989

90-
# Copy configuration
91-
VOLUME [ "/configuration" ]
92-
COPY ./configuration /configuration
93-
9490
# Give the "root" group the same permissions as the "root" user on /etc/passwd
9591
# to allow a user belonging to the root group to add new users; typically the
9692
# docker user (see entrypoint).

src/helm/env.d/dev/values.impress.yaml.gotmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ backend:
8787
python manage.py createsuperuser --email [email protected] --password admin
8888
restartPolicy: Never
8989

90+
themeCustomization:
91+
enabled: true
92+
file_content: {{ readFile "./configuration/theme/demo.json" }}
93+
9094
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
9195
extraVolumeMounts:
9296
- name: certs
@@ -101,7 +105,6 @@ backend:
101105
items:
102106
- key: cacert.pem
103107
path: cacert.pem
104-
105108
frontend:
106109
envVars:
107110
PORT: 8080

src/helm/impress/README.md

Lines changed: 74 additions & 72 deletions
Large diffs are not rendered by default.

src/helm/impress/templates/backend_deployment.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ spec:
9090
subPath: {{ .subPath | default "" }}
9191
readOnly: {{ .readOnly }}
9292
{{- end }}
93+
{{- if .Values.backend.themeCustomization.enabled }}
94+
- name: theme-customization
95+
mountPath: {{ .Values.backend.themeCustomization.mount_path }}
96+
readOnly: true
97+
{{- end }}
9398
{{- with .Values.backend.nodeSelector }}
9499
nodeSelector:
95100
{{- toYaml . | nindent 8 }}
@@ -117,6 +122,11 @@ spec:
117122
claimName: "{{ $fullName }}-{{ $name }}"
118123
{{- end }}
119124
{{- end }}
125+
{{- if .Values.backend.themeCustomization.enabled }}
126+
- name: theme-customization
127+
configMap:
128+
name: docs-theme-customization
129+
{{- end }}
120130
{{- range .Values.backend.extraVolumes }}
121131
- name: {{ .name }}
122132
{{- if .existingClaim }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.backend.themeCustomization.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: docs-theme-customization
6+
namespace: {{ .Release.Namespace }}
7+
data:
8+
default.json: |
9+
{{ .Values.backend.themeCustomization.file_content | toJson | indent 4 }}
10+
{{- end }}

src/helm/impress/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ ingressMedia:
162162
## @param ingressMedia.annotations.nginx.ingress.kubernetes.io/auth-url
163163
## @param ingressMedia.annotations.nginx.ingress.kubernetes.io/auth-response-headers
164164
## @param ingressMedia.annotations.nginx.ingress.kubernetes.io/upstream-vhost
165+
## @param ingressMedia.annotations.nginx.ingress.kubernetes.io/configuration-snippet
165166
annotations:
166167
nginx.ingress.kubernetes.io/auth-url: https://impress.example.com/api/v1.0/documents/media-auth/
167168
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
@@ -310,6 +311,16 @@ backend:
310311
pdb:
311312
enabled: true
312313

314+
## @param backend.themeCustomization.enabled Enable theme customization
315+
## @param backend.themeCustomization.file_content Content of the theme customization file. Must be a json object.
316+
## @param backend.themeCustomization.mount_path Path where the customization file will be mounted in the backend deployment.
317+
themeCustomization:
318+
enabled: false
319+
file_content: ""
320+
mount_path: /app/configuration/theme/
321+
322+
323+
313324
## @section frontend
314325

315326
frontend:

0 commit comments

Comments
 (0)