From a07d953e1fa53a25c0327f9ba793b0f4bcebd2df Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Fri, 30 Aug 2024 11:53:50 +0200 Subject: [PATCH] [ksm/customresources/pod] Use given fieldSelector in ListWatch --- pkg/collector/corechecks/cluster/ksm/customresources/pod.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/pod.go b/pkg/collector/corechecks/cluster/ksm/customresources/pod.go index ee749c094c1288..4fcf26365d04e7 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/pod.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/pod.go @@ -238,15 +238,15 @@ func (f *extendedPodFactory) ExpectedType() interface{} { } // ListWatch returns a ListerWatcher for v1.Pod -// -//nolint:revive // TODO(CINT) Fix revive linter func (f *extendedPodFactory) ListWatch(customResourceClient interface{}, ns string, fieldSelector string) cache.ListerWatcher { client := customResourceClient.(clientset.Interface) return &cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + opts.FieldSelector = fieldSelector return client.CoreV1().Pods(ns).List(context.TODO(), opts) }, WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + opts.FieldSelector = fieldSelector return client.CoreV1().Pods(ns).Watch(context.TODO(), opts) }, }