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:
1 parent
d40bd0c7d0
commit
317c4cf072
2 files changed
+18
-1
No files matched your search
@@ -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[] {
|
||||
|
||||
Reference in new issue
Block a user