Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
sumedha-redd committed Jul 30, 2024
1 parent 0bd4400 commit 7e2b14d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package run

import (
"context"
"strings"

"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -46,7 +45,7 @@ type Options struct {

MetricNamespace string

WatchNamespaces string
WatchNamespaces []string
}

// RecommendedOptions builds a new options config with default values
Expand Down Expand Up @@ -78,11 +77,12 @@ func NewCmdRun(o *Options) *cobra.Command {
bootstrapFlags := namedFlagSets.FlagSet("bootstrap")
bootstrapFlags.BoolVar(&o.BootstrapCRDs, "crd", true, "if set, the operator will attempt to install/update the CRDs before starting up.")
bootstrapFlags.StringVar(&o.BootstrapSpicedbsPath, "bootstrap-spicedbs", "", "set a path to a config file for spicedbs to load on start up.")
bootstrapFlags.StringVar(&o.WatchNamespaces, "watch-namespaces", "", "set a comma-separated list of namespaces to watch for CRDs.")
debugFlags := namedFlagSets.FlagSet("debug")
debugFlags.StringVar(&o.DebugAddress, "debug-address", o.DebugAddress, "address where debug information is served (/healthz, /metrics/, /debug/pprof, etc)")
o.ConfigFlags.AddFlags(namedFlagSets.FlagSet("kubernetes"))
o.DebugFlags.AddFlags(debugFlags)
kubernetesFlags := namedFlagSets.FlagSet("kubernetes")
kubernetesFlags.StringSliceVar(&o.WatchNamespaces, "watch-namespaces", []string{}, "set a comma-separated list of namespaces to watch for CRDs.")
o.ConfigFlags.AddFlags(kubernetesFlags)
globalFlags := namedFlagSets.FlagSet("global")
globalflag.AddGlobalFlags(globalFlags, cmd.Name())
globalFlags.StringVar(&o.OperatorConfigPath, "config", "", "set a path to the operator's config file (configure registries, image tags, etc)")
Expand Down Expand Up @@ -152,11 +152,7 @@ func (o *Options) Run(ctx context.Context, f cmdutil.Factory) error {
controllers = append(controllers, staticSpiceDBController)
}

namespaces := []string{}
if len(o.WatchNamespaces) > 0 {
namespaces = strings.Split(o.WatchNamespaces, ",")
}
ctrl, err := controller.NewController(ctx, registry, dclient, kclient, resources, o.OperatorConfigPath, broadcaster, namespaces)
ctrl, err := controller.NewController(ctx, registry, dclient, kclient, resources, o.OperatorConfigPath, broadcaster, o.WatchNamespaces)
if err != nil {
return err
}
Expand Down

0 comments on commit 7e2b14d

Please sign in to comment.