Fix a bug in e2epod function

This commit is contained in:
Wei Huang
2020-02-13 16:44:17 -08:00
parent 4bb8df4464
commit c83a860e9d
3 changed files with 80 additions and 3 deletions

View File

@@ -533,8 +533,9 @@ func GetPodsInNamespace(c clientset.Interface, ns string, ignoreLabels map[strin
return []*v1.Pod{}, err
}
ignoreSelector := labels.SelectorFromSet(ignoreLabels)
filtered := []*v1.Pod{}
for _, p := range pods.Items {
var filtered []*v1.Pod
for i := range pods.Items {
p := pods.Items[i]
if len(ignoreLabels) != 0 && ignoreSelector.Matches(labels.Set(p.Labels)) {
continue
}