support empty label filter

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-08-02 11:17:53 +08:00
parent bfa81db9db
commit b93a0802f0
24 changed files with 84 additions and 56 deletions

View File

@@ -57,7 +57,8 @@ func (*s2iRunSearcher) match(match map[string]string, item *v1alpha1.S2iRun) boo
return false
}
default:
if item.Labels[k] != v {
// label not exist or value not equal
if val, ok := item.Labels[k]; !ok || val != v {
return false
}
}
@@ -87,7 +88,7 @@ func (*s2iRunSearcher) fuzzy(fuzzy map[string]string, item *v1alpha1.S2iRun) boo
return false
}
default:
if !searchFuzzy(item.Labels, k, v) && !searchFuzzy(item.Annotations, k, v) {
if !searchFuzzy(item.Labels, k, v) {
return false
}
}