Skip to content

Commit 310b6c2

Browse files
feat(helm): add RO rootfs support for Intel and Collab
Fixes: #168 - tmpfs emptyDir for /run and /tmp - RW runtime at /run/volatile, reuse for /var/log/nginx and /var/cache/nginx - Intel: initContainer to create subpaths - enable via securityContext (readOnlyRootFileSystem, runAsUser=0)
1 parent b7f92f8 commit 310b6c2

4 files changed

Lines changed: 47 additions & 3 deletions

File tree

charts/collab/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ spec:
182182
name: codetogether-runtime
183183
- mountPath: /tmp
184184
name: codetogether-tmp
185+
- mountPath: /var/log/nginx
186+
name: codetogether-runtime
187+
- mountPath: /var/cache/nginx
188+
name: codetogether-runtime
185189
{{- if .Values.favicon.enabled }}
186190
- mountPath: /opt/volatile-template/nginx/favicon.ico
187191
name: favicon-volume

charts/collab/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ securityContext: {}
210210
# capabilities:
211211
# drop:
212212
# - ALL
213-
# readOnlyRootFilesystem: true
213+
readOnlyRootFilesystem: true
214214
# runAsNonRoot: true
215-
# runAsUser: 1000
215+
runAsUser: 0
216216

217217
readinessProbe:
218218
initialDelaySeconds: 60

charts/intel/templates/deployment.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ spec:
2626
imagePullSecrets:
2727
- name: {{ include "codetogether.fullname" . }}-pull-secret
2828
{{- end }}
29+
{{- if .Values.readOnlyMode.enabled }}
30+
initContainers:
31+
- name: prepare-ro
32+
image: busybox:latest
33+
securityContext:
34+
runAsUser: 0
35+
command: ["sh", "-lc", "mkdir -p /mnt/volatile/var-log-nginx /mnt/volatile/var-cache-nginx /mnt/var/log-codetogether || true"]
36+
volumeMounts:
37+
- name: volatile
38+
mountPath: /mnt/volatile
39+
{{- end }}
2940
serviceAccountName: {{ include "codetogether.serviceAccountName" . }}
3041
containers:
3142
- name: {{ .Chart.Name }}
@@ -108,6 +119,20 @@ spec:
108119
mountPath: /etc/ssl/certs/java/cacerts
109120
subPath: cacerts
110121
{{- end }}
122+
{{- if .Values.readOnlyMode.enabled }}
123+
- name: volatile
124+
mountPath: /run/volatile
125+
- name: run
126+
mountPath: /run
127+
- name: tmp
128+
mountPath: /tmp
129+
- name: volatile
130+
mountPath: /var/log/nginx
131+
subPath: var-log-nginx
132+
- name: volatile
133+
mountPath: /var/cache/nginx
134+
subPath: var-cache-nginx
135+
{{- end }}
111136
ports:
112137
- name: http
113138
containerPort: 1080
@@ -156,6 +181,16 @@ spec:
156181
secret:
157182
secretName: {{ .Values.java.customCacerts.cacertsSecretName }}
158183
{{- end }}
184+
{{- if .Values.readOnlyMode.enabled }}
185+
- name: volatile
186+
emptyDir: {}
187+
- name: run
188+
emptyDir:
189+
medium: Memory
190+
- name: tmp
191+
emptyDir:
192+
medium: Memory
193+
{{- end }}
159194
{{- with .Values.nodeSelector }}
160195
nodeSelector:
161196
{{- toYaml . | nindent 8 }}

charts/intel/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ serviceAccount:
133133
podAnnotations: {}
134134

135135
securityContext: {}
136+
136137
# capabilities:
137138
# drop:
138139
# - ALL
139-
# readOnlyRootFilesystem: true
140+
readOnlyRootFilesystem: true
141+
runAsUser: 0
140142
# runAsNonRoot: true
141143
# runAsUser: 1000
142144

@@ -179,3 +181,6 @@ tolerations: []
179181
affinity: {}
180182

181183
replicaCount: 1
184+
185+
readOnlyMode:
186+
enabled: true

0 commit comments

Comments
 (0)