mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix accessible namespaces functionality under restrictive RBAC (#2138)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
d40bd0c7d0
commit
317c4cf072
@ -399,6 +399,8 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
this.accessible = false;
|
this.accessible = false;
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
this.activated = false;
|
this.activated = false;
|
||||||
|
this.allowedNamespaces = [];
|
||||||
|
this.accessibleNamespaces = [];
|
||||||
this.resourceAccessStatuses.clear();
|
this.resourceAccessStatuses.clear();
|
||||||
this.pushState();
|
this.pushState();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,22 @@ export const clusterContext: ClusterContext = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get allNamespaces(): string[] {
|
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[] {
|
get contextNamespaces(): string[] {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user