diff --git a/src/renderer/kube-object.store.ts b/src/renderer/kube-object.store.ts index e0b54cf3b7..d1fd3f6aea 100644 --- a/src/renderer/kube-object.store.ts +++ b/src/renderer/kube-object.store.ts @@ -100,13 +100,19 @@ export abstract class KubeObjectStore extends ItemSt protected async loadItems({ namespaces, api }: KubeObjectStoreLoadingParams): Promise { if (this.context?.cluster.isAllowedResource(api.kind)) { - if (api.isNamespaced) { - return Promise + if (!api.isNamespaced) { + return api.list({}, this.query); + } + + const isLoadingAll = this.context.allNamespaces.every(ns => namespaces.includes(ns)); + + if (isLoadingAll) { + return api.list({}, this.query); + } else { + return Promise // load resources per namespace .all(namespaces.map(namespace => api.list({ namespace }))) .then(items => items.flat()); } - - return api.list({}, this.query); } return [];