Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FieldSelector doesn't appear to be filtering properly #1350

Open
jacobwolfaws opened this issue Apr 19, 2024 · 0 comments
Open

FieldSelector doesn't appear to be filtering properly #1350

jacobwolfaws opened this issue Apr 19, 2024 · 0 comments

Comments

@jacobwolfaws
Copy link

I'm trying to filter a list of pods based on the node they're on:

podList, err := clientset.CoreV1().Pods("").List(context.Background(), metav1.ListOptions{
FieldSelector: fmt.Sprintf("spec.nodeName=%s", nodeName),
})

but the FieldSelector doesn't appear to be filtering them properly. I'm currently working around this by doing:

for _, pod := range podList.Items {
		if pod.Spec.NodeName == nodeName {
         # Take action here
         }
}

slack thread: https://kubernetes.slack.com/archives/C0EG7JC6T/p1713547391787689?thread_ts=1713212213.662529&cid=C0EG7JC6T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant