What happened
When a pod contains both a privileged container and a GPU-requesting container, the mutating admission webhook logs that it is denying admission for the privileged container, but still allows the pod and applies scheduler/GPU patches.
What you expected to happen
Any pod with a privileged container should be rejected with admission.Denied(...).
How to reproduce
- Configure the HAMi webhook with a GPU resource name (e.g.
hami.io/gpu).
- Submit a pod with two containers:
- Container A:
securityContext.privileged: true
- Container B: requests
hami.io/gpu: "1"
- Observe the webhook response:
Allowed: true with patches applied.
Minimal pod spec:
apiVersion: v1
kind: Pod
metadata:
name: privileged-gpu-mixed
namespace: default
spec:
containers:
- name: privileged-sidecar
image: busybox
securityContext:
privileged: true
- name: gpu-workload
image: busybox
resources:
limits:
hami.io/gpu: "1"
Root cause
In pkg/scheduler/webhook.go, the privileged-container check uses continue instead of returning admission.Denied:
if ctr.SecurityContext.Privileged != nil && *ctr.SecurityContext.Privileged {
klog.Warningf(..., "Denying admission as container %s is privileged", ...)
continue // should return admission.Denied(...)
}
The loop continues to the next container, GPU resources are mutated, and the pod is admitted.
Impact
- Security/policy bypass for mixed privileged + GPU pods
- Webhook logs say "Denying admission" but the request is allowed
Environment
- HAMi master @ c343242
- Verified locally with a unit test against
pkg/scheduler/webhook.go
What happened
When a pod contains both a privileged container and a GPU-requesting container, the mutating admission webhook logs that it is denying admission for the privileged container, but still allows the pod and applies scheduler/GPU patches.
What you expected to happen
Any pod with a privileged container should be rejected with
admission.Denied(...).How to reproduce
hami.io/gpu).securityContext.privileged: truehami.io/gpu: "1"Allowed: truewith patches applied.Minimal pod spec:
Root cause
In
pkg/scheduler/webhook.go, the privileged-container check usescontinueinstead of returningadmission.Denied:The loop continues to the next container, GPU resources are mutated, and the pod is admitted.
Impact
Environment
pkg/scheduler/webhook.go