From acb67ae84aaa08cbfb259abfbfab58e431a7610f Mon Sep 17 00:00:00 2001 From: varshaprasad96 Date: Sat, 8 May 2021 11:04:13 -0700 Subject: [PATCH] :bug: filter global namespace while looking for cluster scoped resources In the current implementation of multinamespaced cache, we look at global namespace while listing objects from all namespaced. Global namespace should not be looked at while fetching namespaced resources. --- pkg/cache/multi_namespace_cache.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cache/multi_namespace_cache.go b/pkg/cache/multi_namespace_cache.go index 7e3f67d8d4..9bca01cf7f 100644 --- a/pkg/cache/multi_namespace_cache.go +++ b/pkg/cache/multi_namespace_cache.go @@ -190,7 +190,10 @@ func (c *multiNamespaceCache) List(ctx context.Context, list client.ObjectList, limitSet := listOpts.Limit > 0 var resourceVersion string - for _, cache := range c.namespaceToCache { + for ns, cache := range c.namespaceToCache { + if ns == globalCache { + continue + } listObj := list.DeepCopyObject().(client.ObjectList) err = cache.List(ctx, listObj, &listOpts) if err != nil {