Skip to content

Commit 4907ef4

Browse files
authored
Merge pull request #477 from wunderio/feat/securityContext
feat(frontend): add security context support
2 parents 1aa9d42 + e67f72d commit 4907ef4

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

frontend/templates/services-cron.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ spec:
3131
containers:
3232
- name: {{ $jobName }}-cron
3333
image: {{ $service.image | quote }}
34+
{{- if $service.securityContext }}
35+
securityContext:
36+
{{- toYaml $service.securityContext | nindent 14 }}
37+
{{- end }}
3438
volumeMounts:
3539
{{- if $service.mounts }}
3640
{{- range $index, $mountName := $service.mounts -}}

frontend/templates/services-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ spec:
3333
containers:
3434
- name: {{ $index }}
3535
image: {{ $service.image | quote }}
36+
{{- if $service.securityContext }}
37+
securityContext:
38+
{{- toYaml $service.securityContext | nindent 10 }}
39+
{{- end }}
3640
ports:
3741
- containerPort: {{ default $.Values.serviceDefaults.port $service.port }}
3842
name: {{ $index }}

frontend/values.schema.json

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"branchName": { "type": "string" },
99
"imagePullSecrets": { "type": "array" },
1010
"imagePullSecret": { "type": "string" },
11-
"serviceAccount": {
11+
"serviceAccount": {
1212
"type": "object",
1313
"additionalProperties": false,
1414
"properties": {
@@ -320,6 +320,64 @@
320320
"nodeSelector": {
321321
"type": "object",
322322
"additionalProperties": { "type": "string" }
323+
},
324+
"securityContext": {
325+
"type": "object",
326+
"additionalProperties": false,
327+
"properties": {
328+
"allowPrivilegeEscalation": { "type": "boolean" },
329+
"readOnlyRootFilesystem": { "type": "boolean" },
330+
"runAsNonRoot": { "type": "boolean" },
331+
"runAsUser": { "type": "integer" },
332+
"runAsGroup": { "type": "integer" },
333+
"fsGroup": { "type": "integer" },
334+
"privileged": { "type": "boolean" },
335+
"procMount": { "type": "string" },
336+
"capabilities": {
337+
"type": "object",
338+
"additionalProperties": false,
339+
"properties": {
340+
"add": {
341+
"type": "array",
342+
"items": { "type": "string" }
343+
},
344+
"drop": {
345+
"type": "array",
346+
"items": { "type": "string" }
347+
}
348+
}
349+
},
350+
"seccompProfile": {
351+
"type": "object",
352+
"additionalProperties": false,
353+
"properties": {
354+
"type": { "type": "string" },
355+
"localhostProfile": { "type": "string" }
356+
}
357+
},
358+
"seLinuxOptions": {
359+
"type": "object",
360+
"additionalProperties": false,
361+
"properties": {
362+
"level": { "type": "string" },
363+
"role": { "type": "string" },
364+
"type": { "type": "string" },
365+
"user": { "type": "string" }
366+
}
367+
},
368+
"sysctls": {
369+
"type": "array",
370+
"items": {
371+
"type": "object",
372+
"additionalProperties": false,
373+
"properties": {
374+
"name": { "type": "string" },
375+
"value": { "type": "string" }
376+
},
377+
"required": ["name", "value"]
378+
}
379+
}
380+
}
323381
}
324382
}
325383
}

frontend/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ environmentName: ""
2323
# See https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
2424
imagePullSecrets: []
2525

26-
# Custom imagePullSecret for the containers. Base64 encoded. This will create a secret and append it to the imagePullSecrets.
26+
# Custom imagePullSecret for the containers. Base64 encoded. This will create a secret and append it to the imagePullSecrets.
2727
imagePullSecret: ""
2828

2929
serviceAccount:
@@ -227,6 +227,9 @@ services: {}
227227
# # Use storage mountpoints (defined in the mounts section) for this service.
228228
# mounts:
229229
# - files
230+
#
231+
# # Security context settings for this service
232+
# securityContext: { }
230233

231234
# # Enable autoscaling using HorizontalPodAutoscaler
232235
# # see: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/

0 commit comments

Comments
 (0)