Merge pull request #836 from wansir/fix-pod-filter

fix: filter pod by service name
This commit is contained in:
KubeSphere CI Bot
2019-09-29 17:23:13 +08:00
committed by GitHub

View File

@@ -140,7 +140,7 @@ func podBelongToService(item *v1.Pod, serviceName string) bool {
}
selector := labels.Set(service.Spec.Selector).AsSelectorPreValidated()
if !selector.Matches(labels.Set(item.Labels)) {
if selector.Empty() || !selector.Matches(labels.Set(item.Labels)) {
return false
}
return true