1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

only attempt to list if not specified

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton 2020-08-19 09:08:24 -04:00 committed by Sebastian Malton
parent 394ccbde29
commit ff928183cc

View File

@ -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 [];
}
}