File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -523,13 +523,17 @@ func wrapNodeFunc(f func(*v1.Node) *metric.Family) func(interface{}) *metric.Fam
523
523
}
524
524
525
525
func createNodeListWatch (kubeClient clientset.Interface , _ string , fieldSelector string ) cache.ListerWatcher {
526
- // if given node name, it then lists and watches specified node by its name instead of all nodes.
526
+ // if node name given , it then lists and watches specified node by its name instead of all nodes.
527
527
if fieldSelector != "" {
528
528
selector , _ := fields .ParseSelector (fieldSelector )
529
529
nodeName , ok := selector .RequiresExactMatch ("spec.nodeName" )
530
530
if ok {
531
531
fieldSelector = fields .OneTermEqualSelector ("metadata.name" , nodeName ).String ()
532
532
klog .InfoS ("Transform fieldSelector for node store" , "fieldSelector" , fieldSelector )
533
+ } else {
534
+ // it removes the field selector if it does not contain node name.
535
+ // for example, the namespace selector is not necessary for nodes resource.
536
+ fieldSelector = ""
533
537
}
534
538
}
535
539
return & cache.ListWatch {
You can’t perform that action at this time.
0 commit comments