From 77006c1473d352602c82d628ceef63f234d5a0b7 Mon Sep 17 00:00:00 2001 From: payall4u Date: Wed, 29 Nov 2023 15:05:55 +0800 Subject: [PATCH] fix some bug --- pkg/webhooks/pod/mutating.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/webhooks/pod/mutating.go b/pkg/webhooks/pod/mutating.go index 53c9de9e8..c1dbd6ec6 100644 --- a/pkg/webhooks/pod/mutating.go +++ b/pkg/webhooks/pod/mutating.go @@ -50,10 +50,9 @@ func (m *MutatingAdmission) Default(ctx context.Context, obj runtime.Object) err return err } - if ls.Matches(labels.Set(pod.Labels)) { - if m.Config.QOSInitializer.InitContainerTemplate != nil { - pod.Spec.InitContainers = append(pod.Spec.InitContainers, *m.Config.QOSInitializer.InitContainerTemplate) - } + if !ls.Matches(labels.Set(pod.Labels)) { + klog.Infof("injection skipped: webhook is not interested in the pod") + return nil } qosSlice, err := m.listPodQOS()