Skip to content

Commit b974d2e

Browse files
authored
chore(helm): add podSecurityContext and containerSecurityContext values to controller chart (#753)
* add security context param into helm to make sandbox compliant to k8s policies * apply PR suggestion
1 parent 4fd7837 commit b974d2e

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

helm/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@ The following table lists the configurable parameters and their defaults.
9797
| `nodeSelector` | Node selector for the controller pod | `{}` |
9898
| `tolerations` | Tolerations for the controller pod | `[]` |
9999
| `affinity` | Affinity rules for the controller pod | `{}` |
100+
| `podSecurityContext` | Pod `securityContext`; only rendered when set (e.g. Kyverno / Pod Security) | `null` |
101+
| `containerSecurityContext` | Container `securityContext` for the controller; only rendered when set | `null` |
100102
| `podAnnotations` | Annotations added to the controller pod template (e.g. service-mesh sidecar toggles, Prometheus scrape autodiscovery) | `{}` |
101103
| `podLabels` | Extra labels added to the controller pod template alongside the chart's selector labels (selector labels take precedence on conflict) | `{}` |

helm/templates/deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ spec:
2121
{{- end }}
2222
spec:
2323
serviceAccountName: agent-sandbox-controller
24+
{{- with .Values.podSecurityContext }}
25+
securityContext:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
2428
containers:
2529
- name: agent-sandbox-controller
2630
image: {{ include "agent-sandbox.image" . }}
@@ -50,6 +54,10 @@ spec:
5054
resources:
5155
{{- toYaml . | nindent 10 }}
5256
{{- end }}
57+
{{- with .Values.containerSecurityContext }}
58+
securityContext:
59+
{{- toYaml . | nindent 10 }}
60+
{{- end }}
5361
volumeMounts:
5462
- name: config-volume
5563
mountPath: /etc/sandbox-config

helm/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,23 @@ nodeSelector: {}
6060
tolerations: []
6161

6262
affinity: {}
63+
64+
# Pod-level securityContext (spec.template.spec.securityContext). Default null — omitted unless set.
65+
# Example for Kyverno / restricted Pod Security:
66+
# podSecurityContext:
67+
# runAsNonRoot: true
68+
# seccompProfile:
69+
# type: RuntimeDefault
70+
podSecurityContext: null
71+
72+
# Container-level securityContext for the controller. Default null — omitted unless set.
73+
# Example:
74+
# containerSecurityContext:
75+
# allowPrivilegeEscalation: false
76+
# capabilities:
77+
# drop:
78+
# - ALL
79+
# runAsNonRoot: true
80+
# seccompProfile:
81+
# type: RuntimeDefault
82+
containerSecurityContext: null

0 commit comments

Comments
 (0)