only attempt to list if not specified

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton authored and Sebastian Malton committed 2020-11-09 10:05:19 -05:00
1 parent 394ccbde29
commit ff928183cc
1 file changed
+5 -1
+5 -1
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 [];
}
}