From ff928183cc5909b15f497022fc3b9f8b96eae63f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 19 Aug 2020 09:08:24 -0400 Subject: [PATCH] only attempt to list if not specified Signed-off-by: Sebastian Malton --- src/main/cluster.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 01e11a48df..8d80ca9dd4 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -427,6 +427,10 @@ export class Cluster implements ClusterModel, ClusterState { } protected async getAllowedNamespaces() { + if (this.accessibleNamespaces?.length) { + return this.accessibleNamespaces + } + const api = this.getProxyKubeconfig().makeApiClient(CoreV1Api) try { const namespaceList = await api.listNamespace() @@ -443,7 +447,7 @@ export class Cluster implements ClusterModel, ClusterState { } catch (error) { const ctx = this.getProxyKubeconfig().getContextObject(this.contextName) if (ctx.namespace) return [ctx.namespace] - return this.accessibleNamespaces || []; + return []; } }