diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 23ac8ca7..b23d341a 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -16,21 +16,15 @@ limitations under the License. package utils import ( - "fmt" "os" ) -// GetWatchNamespace returns the Namespace the operator should be watching for changes -func GetWatchNamespace() (string, error) { - // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE - // which specifies the Namespace to watch. - // An empty value means the operator is running with cluster scope. - var watchNamespaceEnvVar = "WATCH_NAMESPACE" - - ns, found := os.LookupEnv(watchNamespaceEnvVar) - if !found { - return "", fmt.Errorf("%s must be set", watchNamespaceEnvVar) - } +// WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE +// which specifies the Namespace to watch. +// An empty value means the operator is running with cluster scope. +const WatchNamespaceEnvVar = "WATCH_NAMESPACE" - return ns, nil +// GetWatchNamespace returns the Namespace the operator should be watching for changes +func GetWatchNamespace() (string, bool) { + return os.LookupEnv(WatchNamespaceEnvVar) }