INNER CODE UNIT · Go
ctx
grafana/grafana-operator · main.go:313
ctx = klog.NewContext(ctx, setupLog) // Leader election logger is set through the ctx
// Determine Operator scope
switch {
case strings.Contains(operatorConfig.WatchNamespace, ","):
// multi namespace scoped
mgrOptions.Cache.DefaultNamespaces = getNamespaceConfig(operatorConfig.WatchNamespace, labelSelectors)
setupLog.Info("operator running in namespace scoped mode for multiple namespaces", "namespaces", operatorConfig.WatchNamespace)
case operatorConfig.WatchNamespace != "":
// namespace scoped
mgrOptions.Cache.DefaultNamespaces = getNamespaceConfig(operatorConfig.WatchNamespace, labelSelectors)
setupLog.Info("operator running in namespace scoped mode", "namespace", operatorConfig.WatchNamespace)
case strings.Contains(operatorConfig.WatchNamespaceSelector, ":"):
// multi namespace scoped
mgrOptions.Cache.DefaultNamespaces = getNamespaceConfigSelector(ctx, restConfig, operatorConfig.WatchNamespaceSelector, labelSelectors)
setupLog.Info("operator running in namespace scoped mode using namespace selector", "selector", operatorConfig.WatchNamespaceSelector)
case operatorConfig.WatchNamespace == "" && operatorConfig.WatchNamespaceSelector == "":