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

fix accessible namespaces functionality under restrictive RBAC

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-02-12 13:33:30 +02:00
parent f7f2d445a1
commit 901678f985
2 changed files with 18 additions and 1 deletions

View File

@ -399,6 +399,8 @@ export class Cluster implements ClusterModel, ClusterState {
this.accessible = false;
this.ready = false;
this.activated = false;
this.allowedNamespaces = [];
this.accessibleNamespaces = [];
this.resourceAccessStatuses.clear();
this.pushState();
}

View File

@ -14,7 +14,22 @@ export const clusterContext: ClusterContext = {
},
get allNamespaces(): string[] {
return this.cluster?.allowedNamespaces ?? [];
if (!this.cluster) {
return [];
}
// user given list of namespaces
if (this.cluster?.accessibleNamespaces.length) {
return this.cluster.accessibleNamespaces;
}
if (namespaceStore.items.length > 0) {
// namespaces from kubernetes api
return namespaceStore.items.map((namespace) => namespace.getName());
} else {
// fallback to cluster resolved namespaces because we could not load list
return this.cluster.allowedNamespaces || [];
}
},
get contextNamespaces(): string[] {