fix node-agent node detection logic

Add namespace in ListOptions, to fix node-agent node detection
in its deployed namespace.

Signed-off-by: Adam Zhang <adam.zhang@broadcom.com>
This commit is contained in:
Adam Zhang
2026-04-03 14:31:13 +08:00
parent 856f1296fc
commit ea057e42fa
3 changed files with 42 additions and 10 deletions
+4 -1
View File
@@ -97,7 +97,10 @@ func isRunningInNode(ctx context.Context, namespace string, nodeName string, crC
}
if crClient != nil {
err = crClient.List(ctx, pods, &ctrlclient.ListOptions{LabelSelector: parsedSelector})
err = crClient.List(ctx, pods, &ctrlclient.ListOptions{
LabelSelector: parsedSelector,
Namespace: namespace,
})
} else {
pods, err = kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: parsedSelector.String()})
}