Skip to content

Commit

Permalink
Update watcher.go
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasLemince authored Jun 14, 2021
1 parent 5486932 commit 75be0ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/k8s/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ func watch(g *workgroup.Group, c cache.Getter, log logrus.FieldLogger, resource
//Check if the env var RESTRICTED_NAMESPACE is empty or equal to keel
// If equal to keel or empty, the scan will be over all the cluster
// If RESTRICTED_NAMESPACE is different than keel or empty, keel will scan in the defined namespace
namespace_scan := "keel"
namespaceScan := "keel"
if os.Getenv(constants.EnvRestrictedNamespace) == "keel" {
namespace_scan = v1.NamespaceAll
namespaceScan = v1.NamespaceAll
} else if os.Getenv(constants.EnvRestrictedNamespace) == "" {
namespace_scan = v1.NamespaceAll
namespaceScan = v1.NamespaceAll
} else {
namespace_scan = os.Getenv(constants.EnvRestrictedNamespace)
namespaceScan = os.Getenv(constants.EnvRestrictedNamespace)
}

lw := cache.NewListWatchFromClient(c, resource, namespace_scan, fields.Everything())
lw := cache.NewListWatchFromClient(c, resource, namespaceScan, fields.Everything())
sw := cache.NewSharedInformer(lw, objType, 30*time.Minute)
for _, r := range rs {
sw.AddEventHandler(r)
Expand Down

0 comments on commit 75be0ab

Please sign in to comment.