Respect static list of allowed namespaces (#1639)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-12-03 15:22:47 +02:00
1 parent 67f3f83610
commit 29f2497d48
2 files changed
+14 -2

No files matched your search

@@ -5,6 +5,7 @@ import { Namespace, namespacesApi } from "../../api/endpoints";
import { IQueryParams, navigation, setQueryParams } from "../../navigation";
import { apiManager } from "../../api/api-manager";
import { isAllowedResource } from "../../../common/rbac";
import { getHostedCluster } from "../../../common/cluster-store";
@autobind()
export class NamespaceStore extends KubeObjectStore<Namespace> {
@@ -41,6 +42,17 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
};
}
subscribe(apis = [this.api]) {
const { allowedNamespaces } = getHostedCluster();
// if user has given static list of namespaces let's not start watches because watch adds stuff that's not wanted
if (allowedNamespaces.length > 0) {
return () => { return; };
}
return super.subscribe(apis);
}
protected updateUrl(namespaces: string[]) {
setQueryParams({ namespaces }, { replace: true });
}