From 7cec3380a406045685968769ca209d69b586e114 Mon Sep 17 00:00:00 2001 From: Willem Monsuwe Date: Wed, 31 Jul 2024 15:08:44 +0200 Subject: [PATCH] Look at all namespace unless overridden Signed-off-by: Willem Monsuwe --- internal/backend/kubernetes/backend.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/internal/backend/kubernetes/backend.go b/internal/backend/kubernetes/backend.go index dca33eb1..6d6e5654 100644 --- a/internal/backend/kubernetes/backend.go +++ b/internal/backend/kubernetes/backend.go @@ -51,7 +51,9 @@ func NewBackend(ctx context.Context, cfg Config) (*Backend, error) { conf := func(opts *cluster.Options) { opts.Scheme = scheme - opts.Cache.DefaultNamespaces = map[string]cache.Config{cfg.Namespace: {}} + if cfg.Namespace != "" { + opts.Cache.DefaultNamespaces = map[string]cache.Config{cfg.Namespace: {}} + } } clstr, err := cluster.New(cfg.ClientConfig, conf) @@ -104,14 +106,6 @@ func loadConfig(cfg Config) (Config, error) { } cfg.ClientConfig = config - // In the event no namespace was provided for override, we need to fill it in with whatever - // namespace was loaded from the kubeconfig. - namespace, _, err := loader.Namespace() - if err != nil { - return Config{}, err - } - cfg.Namespace = namespace - return cfg, nil }