Skip to content

Commit

Permalink
[ksm/customresources/pod] Use given fieldSelector in ListWatch
Browse files Browse the repository at this point in the history
  • Loading branch information
davidor committed Aug 30, 2024
1 parent 826ee2b commit a07d953
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/collector/corechecks/cluster/ksm/customresources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}
Expand Down

0 comments on commit a07d953

Please sign in to comment.