pkg/util/cluster.go (15 lines of code) (raw):
package util
import (
"fmt"
"os"
)
const (
watchNamespaceEnvVar = "WATCH_NAMESPACE"
)
// GetWatchNamespace returns the namespace the operator should be watching for changes.
func GetWatchNamespace() (string, error) {
ns, found := os.LookupEnv(watchNamespaceEnvVar)
if !found {
return "", fmt.Errorf("%s must be set", watchNamespaceEnvVar)
}
return ns, nil
}