Skip to content

Commit

Permalink
Fix the noop predicate that's used for all namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
  • Loading branch information
jkremser committed Apr 10, 2024
1 parent 37a21da commit 93e6055
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/util/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func GetWatchNamespaces() (map[string]cache.Config, error) {
return map[string]cache.Config{}, fmt.Errorf("%s must be set", WatchNamespaceEnvVar)
}

if ns == "" {
if ns == "" || ns == "\"\"" {
return map[string]cache.Config{}, nil
}
nss := strings.Split(ns, ",")
Expand All @@ -31,11 +31,11 @@ func GetWatchNamespaces() (map[string]cache.Config, error) {
}

// IgnoreOtherNamespaces returns the predicate for watched events that will filter out those that are not coming
// from a watched namespace (empty namespace denotes all)
// from a watched namespace (empty namespace or unset env var denotes all)
func IgnoreOtherNamespaces() predicate.Predicate {
nss, e := GetWatchNamespaces()
if len(nss) == 0 || e != nil {
return predicate.Or()
return predicate.And() // no-op predicate that returns always true
}
return predicate.Funcs{
GenericFunc: func(e event.GenericEvent) bool {
Expand Down

0 comments on commit 93e6055

Please sign in to comment.