Merge pull request #126588 from jingyuanliang/master

kubectl/describe: use function calls to build field selector
This commit is contained in:
Kubernetes Prow Robot 2024-09-19 14:32:09 +01:00 committed by GitHub
commit 5302055b07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3640,10 +3640,11 @@ func (d *NodeDescriber) Describe(namespace, name string, describerSettings Descr
return "", err
}
fieldSelector, err := fields.ParseSelector("spec.nodeName=" + name + ",status.phase!=" + string(corev1.PodSucceeded) + ",status.phase!=" + string(corev1.PodFailed))
if err != nil {
return "", err
}
fieldSelector := fields.AndSelectors(
fields.OneTermEqualSelector("spec.nodeName", name),
fields.OneTermNotEqualSelector("status.phase", string(corev1.PodSucceeded)),
fields.OneTermNotEqualSelector("status.phase", string(corev1.PodFailed)),
)
// in a policy aware setting, users may have access to a node, but not all pods
// in that case, we note that the user does not have access to the pods
canViewPods := true