Skip to content

Commit 5d09253

Browse files
authored
Merge pull request #156 from tosi3k/fix-list-watch
Fix options provided to CPA's Nodes List and Watch requests
2 parents a6a6f91 + 8b98b92 commit 5d09253

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/autoscaler/k8sclient/k8sclient.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ func NewK8sClient(namespace, target string, nodelabels string) (K8sClient, error
8383
}
8484

8585
// Start propagating contents of the nodeStore.
86-
87-
opts := metav1.ListOptions{LabelSelector: nodelabels}
8886
nodeListWatch := &cache.ListWatch{
8987
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
90-
return clientset.CoreV1().Nodes().List(context.TODO(), opts)
88+
options.LabelSelector = nodelabels
89+
return clientset.CoreV1().Nodes().List(context.TODO(), options)
9190
},
9291
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
93-
return clientset.CoreV1().Nodes().Watch(context.TODO(), opts)
92+
options.LabelSelector = nodelabels
93+
return clientset.CoreV1().Nodes().Watch(context.TODO(), options)
9494
},
9595
}
9696
nodeStore := cache.NewStore(cache.MetaNamespaceKeyFunc)

0 commit comments

Comments
 (0)