Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support csv-format for WATCH_NAMESPACE env var #5631

Merged
merged 9 commits into from
Apr 10, 2024
10 changes: 7 additions & 3 deletions pkg/util/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package util
import (
"fmt"
"os"
"strings"

"sigs.k8s.io/controller-runtime/pkg/cache"
)
Expand All @@ -18,8 +19,11 @@ func GetWatchNamespaces() (map[string]cache.Config, error) {
if ns == "" {
return map[string]cache.Config{}, nil
}
nss := strings.Split(ns, ",")
nssMap := make(map[string]cache.Config)
for _, n := range nss {
nssMap[n] = cache.Config{}
}

return map[string]cache.Config{
ns: {},
}, nil
return nssMap, nil
}
Loading