Skip to content

Commit 2cad48b

Browse files
feat(helm): make init/sidecar securityContexts values-driven on webapp
Adds two new values knobs that override the hardcoded securityContext on the built-in `volume-permissions` init container and `token-syncer` sidecar: webapp: initContainers: securityContext: {} # default: { runAsUser: 1000 } sidecarContainers: securityContext: {} # default: { runAsUser: 1000, runAsNonRoot: true } When unset (default), behavior is unchanged. When set, the user's securityContext fully replaces the chart's hardcoded one — useful for operators that need stricter pod-security admission contexts (FedRAMP / FIPS / Pod Security Standards "restricted" requires runAsNonRoot, allowPrivilegeEscalation: false, capabilities.drop: [ALL], seccompProfile.type: RuntimeDefault on every container). Same idiom as the existing webapp.podSecurityContext and webapp.security- Context (for the webapp container) — adds the missing knobs for the init container and sidecar. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5ac9228 commit 2cad48b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

hosting/k8s/helm/templates/webapp.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,13 @@ spec:
7777
image: {{ include "trigger-v4.webapp.volumePermissions.image" . }}
7878
imagePullPolicy: {{ .Values.webapp.volumePermissions.image.pullPolicy }}
7979
command: ['sh', '-c', 'mkdir -p /home/node/shared']
80+
{{- with .Values.webapp.initContainers.securityContext }}
81+
securityContext:
82+
{{- toYaml . | nindent 12 }}
83+
{{- else }}
8084
securityContext:
8185
runAsUser: 1000
86+
{{- end }}
8287
volumeMounts:
8388
- name: shared
8489
mountPath: /home/node/shared
@@ -89,9 +94,14 @@ spec:
8994
- name: token-syncer
9095
image: {{ include "trigger-v4.webapp.tokenSyncer.image" . }}
9196
imagePullPolicy: {{ .Values.webapp.tokenSyncer.image.pullPolicy }}
97+
{{- with .Values.webapp.sidecarContainers.securityContext }}
98+
securityContext:
99+
{{- toYaml . | nindent 12 }}
100+
{{- else }}
92101
securityContext:
93102
runAsUser: 1000
94103
runAsNonRoot: true
104+
{{- end }}
95105
command:
96106
- /bin/bash
97107
- -c

hosting/k8s/helm/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,21 @@ webapp:
195195
# image: busybox
196196
# command: [...]
197197

198+
# Container-level securityContext applied to the built-in
199+
# `volume-permissions` init container. When unset, defaults to
200+
# `runAsUser: 1000`. Set this to enforce stricter pod-security
201+
# admission (e.g. FIPS / FedRAMP / Pod Security Standards "restricted":
202+
# `runAsNonRoot: true`, `allowPrivilegeEscalation: false`,
203+
# `capabilities.drop: [ALL]`, `seccompProfile.type: RuntimeDefault`).
204+
initContainers:
205+
securityContext: {}
206+
207+
# Container-level securityContext applied to the built-in `token-syncer`
208+
# sidecar. Same shape + intent as `webapp.initContainers.securityContext`.
209+
# Defaults to `{ runAsUser: 1000, runAsNonRoot: true }` when unset.
210+
sidecarContainers:
211+
securityContext: {}
212+
198213
# ServiceMonitor for Prometheus monitoring
199214
serviceMonitor:
200215
enabled: false

0 commit comments

Comments
 (0)