From 9bb107fbfd35a3f56c45754f019347a2c3a1af7e Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Thu, 19 Oct 2023 10:48:02 +0200 Subject: [PATCH] Add label selector also when watching The watcher was not respecting its label selector when watching, only when listing. Fixes: a5b617d47 ("Improve CoreDNS affinity check in basic inttest") Signed-off-by: Tom Wieczorek (cherry picked from commit 75e4230bbce3246a26dbd875f616dd3612322878) (cherry picked from commit ac51abdd7158a5f9d9a056c77dceb92332bba8d3) --- pkg/kubernetes/watch/watcher.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/kubernetes/watch/watcher.go b/pkg/kubernetes/watch/watcher.go index 17f8a705d9e8..85b80ce56a82 100644 --- a/pkg/kubernetes/watch/watcher.go +++ b/pkg/kubernetes/watch/watcher.go @@ -288,6 +288,7 @@ func (w *Watcher[T]) watch(ctx context.Context, resourceVersion string, conditio ResourceVersion: resourceVersion, AllowWatchBookmarks: true, FieldSelector: w.fieldSelector, + LabelSelector: w.labelSelector, TimeoutSeconds: pointer.Int64(maxWatchDurationSecs), }) if err != nil {