Skip to content

Commit

Permalink
fix: Add default values for namespaces to match usage descriptions (k…
Browse files Browse the repository at this point in the history
…ubeflow#2128)

* fix: Add default values for namespaces to match usage descriptions

Signed-off-by: pengfei4.li <pengfei4.li@ly.com>

* fix: remove incorrect cache settings

Signed-off-by: pengfei4.li <pengfei4.li@ly.com>

---------

Signed-off-by: pengfei4.li <pengfei4.li@ly.com>
Co-authored-by: pengfei4.li <pengfei4.li@ly.com>
  • Loading branch information
snappyyouth and tclxpengfei4-li authored Aug 22, 2024
1 parent 4bc6e89 commit 52f818d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions cmd/operator/controller/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func NewStartCommand() *cobra.Command {
}

command.Flags().IntVar(&controllerThreads, "controller-threads", 10, "Number of worker threads used by the SparkApplication controller.")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{}, "The Kubernetes namespace to manage. Will manage custom resource objects of the managed CRD types for the whole cluster if unset.")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{""}, "The Kubernetes namespace to manage. Will manage custom resource objects of the managed CRD types for the whole cluster if unset.")
command.Flags().DurationVar(&cacheSyncTimeout, "cache-sync-timeout", 30*time.Second, "Informer cache sync timeout.")

command.Flags().BoolVar(&enableBatchScheduler, "enable-batch-scheduler", false, "Enable batch schedulers.")
Expand Down Expand Up @@ -300,9 +300,7 @@ func newTLSOptions() []func(c *tls.Config) {
// newCacheOptions creates and returns a cache.Options instance configured with default namespaces and object caching settings.
func newCacheOptions() cache.Options {
defaultNamespaces := make(map[string]cache.Config)
if util.ContainsString(namespaces, cache.AllNamespaces) {
defaultNamespaces[cache.AllNamespaces] = cache.Config{}
} else {
if !util.ContainsString(namespaces, cache.AllNamespaces) {
for _, ns := range namespaces {
defaultNamespaces[ns] = cache.Config{}
}
Expand Down
6 changes: 2 additions & 4 deletions cmd/operator/webhook/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func NewStartCommand() *cobra.Command {
}

command.Flags().IntVar(&controllerThreads, "controller-threads", 10, "Number of worker threads used by the SparkApplication controller.")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{"default"}, "The Kubernetes namespace to manage. Will manage custom resource objects of the managed CRD types for the whole cluster if unset.")
command.Flags().StringSliceVar(&namespaces, "namespaces", []string{""}, "The Kubernetes namespace to manage. Will manage custom resource objects of the managed CRD types for the whole cluster if unset.")
command.Flags().StringVar(&labelSelectorFilter, "label-selector-filter", "", "A comma-separated list of key=value, or key labels to filter resources during watch and list based on the specified labels.")
command.Flags().DurationVar(&cacheSyncTimeout, "cache-sync-timeout", 30*time.Second, "Informer cache sync timeout.")

Expand Down Expand Up @@ -368,9 +368,7 @@ func newTLSOptions() []func(c *tls.Config) {
// newCacheOptions creates and returns a cache.Options instance configured with default namespaces and object caching settings.
func newCacheOptions() cache.Options {
defaultNamespaces := make(map[string]cache.Config)
if util.ContainsString(namespaces, cache.AllNamespaces) {
defaultNamespaces[cache.AllNamespaces] = cache.Config{}
} else {
if !util.ContainsString(namespaces, cache.AllNamespaces) {
for _, ns := range namespaces {
defaultNamespaces[ns] = cache.Config{}
}
Expand Down

0 comments on commit 52f818d

Please sign in to comment.