Skip to content

Commit 2a90c8b

Browse files
jrangelramosclaude
andcommitted
fix(sandbox): add missing PodSecurity restricted:latest fields
Sandbox pods for analysis/execution fail to start on clusters enforcing the restricted Pod Security Standard (default for openshift-* namespaces). Add runAsNonRoot and seccompProfile at both pod and container level in podspec_builder.go and bootstrap.go, matching the pattern already used by the console plugin reconciler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c8d785b commit 2a90c8b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

controller/proposal/podspec_builder.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@ func (b *PodSpecBuilder) Build(
124124
return &corev1.PodSpec{
125125
ServiceAccountName: serviceAccount,
126126
AutomountServiceAccountToken: ptr.To(true),
127-
Containers: []corev1.Container{container},
128-
Volumes: volumes,
127+
SecurityContext: &corev1.PodSecurityContext{
128+
RunAsNonRoot: ptr.To(true),
129+
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
130+
},
131+
Containers: []corev1.Container{container},
132+
Volumes: volumes,
129133
}, nil
130134
}
131135

controller/sandbox/bootstrap.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ func ensureSandboxTemplate(ctx context.Context, c client.Client, image, namespac
103103
"spec": map[string]any{
104104
"serviceAccountName": templateName,
105105
"automountServiceAccountToken": false,
106+
"securityContext": map[string]any{
107+
"runAsNonRoot": true,
108+
"seccompProfile": map[string]any{
109+
"type": "RuntimeDefault",
110+
},
111+
},
106112
"containers": []any{
107113
map[string]any{
108114
"name": "agent",

0 commit comments

Comments
 (0)