mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: getAllowedResources for all namespaces using SelfSubjectRulesReview (#6614)
* fix: getAllowedResources for all namespaces using SelfSubjectRulesReview Signed-off-by: Andreas Hippler <andreas.hippler@goto.com> * fix: refresh accessibility every 15 min Signed-off-by: Andreas Hippler <andreas.hippler@goto.com> * chore: remove unused clusterRefreshHandler Signed-off-by: Andreas Hippler <andreas.hippler@goto.com> * fix: resolve SelfSubjectRulesReview globs Signed-off-by: Andreas Hippler <andreas.hippler@goto.com> Signed-off-by: Andreas Hippler <andreas.hippler@goto.com> Co-authored-by: Andreas Hippler <andreas.hippler@goto.com>
This commit is contained in:
1 parent
612538d9fc
commit
6d7090f8a7
11 files changed
+311
-106
No files matched your search
@@ -10,6 +10,7 @@ import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||
import type { CreateCluster } from "../../common/cluster/create-cluster-injection-token";
|
||||
import { createClusterInjectionToken } from "../../common/cluster/create-cluster-injection-token";
|
||||
import authorizationReviewInjectable from "../../common/cluster/authorization-review.injectable";
|
||||
import authorizationNamespaceReviewInjectable from "../../common/cluster/authorization-namespace-review.injectable";
|
||||
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
||||
import createContextHandlerInjectable from "../context-handler/create-context-handler.injectable";
|
||||
import type { ClusterContextHandler } from "../context-handler/context-handler";
|
||||
@@ -19,6 +20,8 @@ import directoryForTempInjectable from "../../common/app-paths/directory-for-tem
|
||||
import normalizedPlatformInjectable from "../../common/vars/normalized-platform.injectable";
|
||||
import kubectlBinaryNameInjectable from "../kubectl/binary-name.injectable";
|
||||
import kubectlDownloadingNormalizedArchInjectable from "../kubectl/normalized-arch.injectable";
|
||||
import { apiResourceRecord, apiResources } from "../../common/rbac";
|
||||
import listApiResourcesInjectable from "../../common/cluster/list-api-resources.injectable";
|
||||
|
||||
console = new Console(process.stdout, process.stderr); // fix mockFS
|
||||
|
||||
@@ -39,6 +42,8 @@ describe("create clusters", () => {
|
||||
di.override(normalizedPlatformInjectable, () => "darwin");
|
||||
di.override(broadcastMessageInjectable, () => async () => {});
|
||||
di.override(authorizationReviewInjectable, () => () => () => Promise.resolve(true));
|
||||
di.override(authorizationNamespaceReviewInjectable, () => () => () => Promise.resolve(Object.keys(apiResourceRecord)));
|
||||
di.override(listApiResourcesInjectable, () => () => () => Promise.resolve(apiResources));
|
||||
di.override(listNamespacesInjectable, () => () => () => Promise.resolve([ "default" ]));
|
||||
di.override(createContextHandlerInjectable, () => (cluster) => ({
|
||||
restartServer: jest.fn(),
|
||||
|
||||
@@ -11,7 +11,9 @@ import createKubectlInjectable from "../kubectl/create-kubectl.injectable";
|
||||
import createContextHandlerInjectable from "../context-handler/create-context-handler.injectable";
|
||||
import { createClusterInjectionToken } from "../../common/cluster/create-cluster-injection-token";
|
||||
import authorizationReviewInjectable from "../../common/cluster/authorization-review.injectable";
|
||||
import createAuthorizationNamespaceReview from "../../common/cluster/authorization-namespace-review.injectable";
|
||||
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
||||
import createListApiResourcesInjectable from "../../common/cluster/list-api-resources.injectable";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
import detectorRegistryInjectable from "../cluster-detectors/detector-registry.injectable";
|
||||
import createVersionDetectorInjectable from "../cluster-detectors/create-version-detector.injectable";
|
||||
@@ -28,6 +30,8 @@ const createClusterInjectable = getInjectable({
|
||||
createKubectl: di.inject(createKubectlInjectable),
|
||||
createContextHandler: di.inject(createContextHandlerInjectable),
|
||||
createAuthorizationReview: di.inject(authorizationReviewInjectable),
|
||||
createAuthorizationNamespaceReview: di.inject(createAuthorizationNamespaceReview),
|
||||
createListApiResources: di.inject(createListApiResourcesInjectable),
|
||||
createListNamespaces: di.inject(listNamespacesInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
detectorRegistry: di.inject(detectorRegistryInjectable),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { IpcMainInvokeEvent } from "electron";
|
||||
import { BrowserWindow, Menu } from "electron";
|
||||
import { clusterFrameMap } from "../../../../common/cluster-frames";
|
||||
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler } from "../../../../common/ipc/cluster";
|
||||
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler } from "../../../../common/ipc/cluster";
|
||||
import type { ClusterId } from "../../../../common/cluster-types";
|
||||
import { ClusterStore } from "../../../../common/cluster-store/cluster-store";
|
||||
import { broadcastMainChannel, broadcastMessage, ipcMainHandle, ipcMainOn } from "../../../../common/ipc";
|
||||
@@ -61,12 +61,6 @@ export const setupIpcMainHandlers = ({
|
||||
}
|
||||
});
|
||||
|
||||
ipcMainHandle(clusterRefreshHandler, (event, clusterId: ClusterId) => {
|
||||
return ClusterStore.getInstance()
|
||||
.getById(clusterId)
|
||||
?.refresh({ refreshMetadata: true });
|
||||
});
|
||||
|
||||
ipcMainHandle(clusterDisconnectHandler, (event, clusterId: ClusterId) => {
|
||||
emitAppEvent({ name: "cluster", action: "stop" });
|
||||
const cluster = ClusterStore.getInstance().getById(clusterId);
|
||||
|
||||
Reference in new issue
Block a user