Skip to content

Commit 0be56b2

Browse files
author
Harry Li
committed
feat(webhook): add additional check for initContainers and log detail
Signed-off-by: Harry Li <[email protected]>
1 parent 6e77919 commit 0be56b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/scheduler/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ func (h *webhook) Handle(_ context.Context, req admission.Request) admission.Res
6666
klog.Infof(template+" - Pod already has different scheduler assigned", req.Namespace, req.Name, req.UID)
6767
return admission.Allowed("pod already has different scheduler assigned")
6868
}
69-
klog.Infof(template, pod.Namespace, pod.Name, pod.UID)
69+
klog.Infof(template+" - Checking resources and scheduler assignment", pod.Namespace, pod.Name, pod.UID)
7070
hasResource := false
71-
for idx, ctr := range pod.Spec.Containers {
71+
for idx, ctr := range append(pod.Spec.Containers, pod.Spec.InitContainers...) {
7272
c := &pod.Spec.Containers[idx]
7373
if ctr.SecurityContext != nil {
7474
if ctr.SecurityContext.Privileged != nil && *ctr.SecurityContext.Privileged {

0 commit comments

Comments
 (0)