Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package main
import (
"flag"
"os"
"strings"

apiv1alpha1 "github.com/red-hat-storage/ocs-client-operator/api/v1alpha1"
"github.com/red-hat-storage/ocs-client-operator/internal/controller"
Expand Down Expand Up @@ -101,20 +100,6 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

storageclustersSelector := fields.SelectorFromSet(fields.Set{"metadata.name": "storageclusters.ocs.openshift.io"})

defaultNamespaces := map[string]cache.Config{}
operatorNamespace := utils.GetOperatorNamespace()
defaultNamespaces[operatorNamespace] = cache.Config{}

watchNamespace := utils.GetWatchNamespace()
if watchNamespace == "" {
setupLog.Info("No value for env WATCH_NAMESPACE is set. Manager will only watch for resources in the operator deployed namespace.")
} else {
for _, namespace := range strings.Split(watchNamespace, ",") {
defaultNamespaces[namespace] = cache.Config{}
}
}

subscriptionwebhookSelector := fields.SelectorFromSet(fields.Set{"metadata.name": templates.SubscriptionWebhookName})
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Expand All @@ -133,7 +118,6 @@ func main() {
Field: subscriptionwebhookSelector,
},
},
DefaultNamespaces: defaultNamespaces,
},
WebhookServer: webhook.NewServer(webhook.Options{
Port: webhookPort,
Expand Down
8 changes: 0 additions & 8 deletions pkg/utils/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import (
// which is the namespace where operator pod is deployed.
const OperatorNamespaceEnvVar = "OPERATOR_NAMESPACE"

// WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE
// which indicates any other namespace to watch for resources.
const WatchNamespaceEnvVar = "WATCH_NAMESPACE"

// OperatorPodNameEnvVar is the constant for env variable OPERATOR_POD_NAME
const OperatorPodNameEnvVar = "OPERATOR_POD_NAME"

Expand All @@ -59,10 +55,6 @@ func GetOperatorNamespace() string {
return os.Getenv(OperatorNamespaceEnvVar)
}

func GetWatchNamespace() string {
return os.Getenv(WatchNamespaceEnvVar)
}

func ValidateOperatorNamespace() error {
ns := GetOperatorNamespace()
if ns == "" {
Expand Down