1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/core/src/main/resource-applier/create-resource-applier.injectable.ts
Sebastian Malton a911f08d22 Cleanup 'Cluster' to remove environment specific details
- requestNamespaceListPermissions is infallable so no need to have the extra try/catch

- Refactor isMetricHidden method away from Cluster

- Refactor shouldShowResource out of Cluster

- Refactor isInLocalKubeconfig out of Cluster

- Remove depecrated and unused workspace from Cluster

- Refactor out kubectl as a dependency of Cluster

- Remove from cluster getter used only once

- Split out ClusterConnection from Cluster

- Also split out KubeAuthProxyServer from ContextHandler

- Rename ContextHandler to PrometheusHandler

- Cleanup onNetworkOffline/Online impls within ClusterManager

- Remove annotations from ClusterConnection

- Remove mobx annotations from Cluster

- Rename loadConfigFromFileInjectable

- Remove all uses of dead createClusterInjectionToken

- Fix type errors related to broadcastConnectionUpdate

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2023-03-09 17:42:27 -05:00

38 lines
1.6 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 emitAppEventInjectable from "../../common/app-event-bus/emit-event.injectable";
import removePathInjectable from "../../common/fs/remove.injectable";
import execFileInjectable from "../../common/fs/exec-file.injectable";
import writeFileInjectable from "../../common/fs/write-file.injectable";
import loggerInjectable from "../../common/logger.injectable";
import joinPathsInjectable from "../../common/path/join-paths.injectable";
import { ResourceApplier } from "./resource-applier";
import createKubectlInjectable from "../kubectl/create-kubectl.injectable";
import kubeconfigManagerInjectable from "../kubeconfig-manager/kubeconfig-manager.injectable";
import type { Cluster } from "../../common/cluster/cluster";
const resourceApplierInjectable = getInjectable({
id: "resource-applier",
instantiate: (di, cluster) => new ResourceApplier(
{
deleteFile: di.inject(removePathInjectable),
emitAppEvent: di.inject(emitAppEventInjectable),
execFile: di.inject(execFileInjectable),
joinPaths: di.inject(joinPathsInjectable),
logger: di.inject(loggerInjectable),
writeFile: di.inject(writeFileInjectable),
createKubectl: di.inject(createKubectlInjectable),
proxyKubeconfigManager: di.inject(kubeconfigManagerInjectable, cluster),
},
cluster,
),
lifecycle: lifecycleEnum.keyedSingleton({
getInstanceKey: (di, cluster: Cluster) => cluster.id,
}),
});
export default resourceApplierInjectable;