mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Only read and parse the proxy config once - Reuse the AuthorizationV1Api instance for the entire refresh instead of recreating it between 32 and 302 times, this should allow for reusing sockets Signed-off-by: Sebastian Malton <sebastian@malton.name>
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
|
import { Cluster, ClusterDependencies } from "../../common/cluster/cluster";
|
|
import directoryForKubeConfigsInjectable from "../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
|
import createKubeconfigManagerInjectable from "../kubeconfig-manager/create-kubeconfig-manager.injectable";
|
|
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 listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
|
|
|
const createClusterInjectable = getInjectable({
|
|
instantiate: (di) => {
|
|
const dependencies: ClusterDependencies = {
|
|
directoryForKubeConfigs: di.inject(directoryForKubeConfigsInjectable),
|
|
createKubeconfigManager: di.inject(createKubeconfigManagerInjectable),
|
|
createKubectl: di.inject(createKubectlInjectable),
|
|
createContextHandler: di.inject(createContextHandlerInjectable),
|
|
createAuthorizationReview: di.inject(authorizationReviewInjectable),
|
|
createListNamespaces: di.inject(listNamespacesInjectable),
|
|
};
|
|
|
|
return (model) => new Cluster(dependencies, model);
|
|
},
|
|
|
|
injectionToken: createClusterInjectionToken,
|
|
|
|
lifecycle: lifecycleEnum.singleton,
|
|
});
|
|
|
|
export default createClusterInjectable;
|