Skip to content

Commit

Permalink
Merge pull request #2234 from Fedosin/multiNamespaceCache_defaultOpts
Browse files Browse the repository at this point in the history
馃尡 Don't call defaultOpts for MultiNamespaceCache twice
  • Loading branch information
k8s-ci-robot committed Mar 18, 2023
2 parents a26de2d + 2251039 commit c3c1f05
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,18 @@ type ByObject struct {

// New initializes and returns a new Cache.
func New(config *rest.Config, opts Options) (Cache, error) {
opts, err := defaultOpts(config, opts)
if err != nil {
return nil, err
}
if len(opts.Namespaces) == 0 {
opts.Namespaces = []string{metav1.NamespaceAll}
}
if len(opts.Namespaces) > 1 {
return newMultiNamespaceCache(config, opts)
}

opts, err := defaultOpts(config, opts)
if err != nil {
return nil, err
}

byGVK, err := convertToInformerOptsByGVK(opts.ByObject, opts.Scheme)
if err != nil {
return nil, err
Expand Down

0 comments on commit c3c1f05

Please sign in to comment.