mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Making metric parser classes as not injectable
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
4150a9002a
commit
52067b1ea0
3 files changed
+5
-36
No files matched your search
@@ -5,15 +5,14 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { HorizontalPodAutoscaler, HorizontalPodAutoscalerMetricSpec, HorizontalPodAutoscalerMetricStatus } from "../../../common/k8s-api/endpoints";
|
import type { HorizontalPodAutoscaler, HorizontalPodAutoscalerMetricSpec, HorizontalPodAutoscalerMetricStatus } from "../../../common/k8s-api/endpoints";
|
||||||
import { HpaMetricType } from "../../../common/k8s-api/endpoints";
|
import { HpaMetricType } from "../../../common/k8s-api/endpoints";
|
||||||
import horizonalPodAutoscalerV1MetricParser from "./hpa-v1-metric-parser.injectable";
|
import { HorizontalPodAutoscalerV1MetricParser } from "./hpa-v1-metric-parser";
|
||||||
import type { HorizontalPodAutoscalerV2MetricParser } from "./hpa-v2-metric-parser";
|
import { HorizontalPodAutoscalerV2MetricParser } from "./hpa-v2-metric-parser";
|
||||||
import horizonalPodAutoscalerV2MetricParser from "./hpa-v2-metric-parser.injectable";
|
|
||||||
|
|
||||||
const getHorizontalPodAutoscalerMetrics = getInjectable({
|
const getHorizontalPodAutoscalerMetrics = getInjectable({
|
||||||
id: "get-horizontal-pod-autoscaler-metrics",
|
id: "get-horizontal-pod-autoscaler-metrics",
|
||||||
instantiate: (di) => (hpa: HorizontalPodAutoscaler) => {
|
instantiate: () => (hpa: HorizontalPodAutoscaler) => {
|
||||||
const hpaV1Parser = di.inject(horizonalPodAutoscalerV1MetricParser);
|
const hpaV1Parser = new HorizontalPodAutoscalerV1MetricParser();
|
||||||
const hpaV2Parser = di.inject(horizonalPodAutoscalerV2MetricParser);
|
const hpaV2Parser = new HorizontalPodAutoscalerV2MetricParser();
|
||||||
const metrics = hpa.spec?.metrics ?? [];
|
const metrics = hpa.spec?.metrics ?? [];
|
||||||
const currentMetrics = hpa.status?.currentMetrics ?? [];
|
const currentMetrics = hpa.status?.currentMetrics ?? [];
|
||||||
const cpuUtilization = hpa.spec?.targetCPUUtilizationPercentage;
|
const cpuUtilization = hpa.spec?.targetCPUUtilizationPercentage;
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import { HorizontalPodAutoscalerV1MetricParser } from "./hpa-v1-metric-parser";
|
|
||||||
|
|
||||||
const horizonalPodAutoscalerV1MetricParser = getInjectable({
|
|
||||||
id: "horizontal-pod-autoscaler-v1-metric-parser",
|
|
||||||
instantiate: () => {
|
|
||||||
return new HorizontalPodAutoscalerV1MetricParser();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default horizonalPodAutoscalerV1MetricParser;
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import { HorizontalPodAutoscalerV2MetricParser } from "./hpa-v2-metric-parser";
|
|
||||||
|
|
||||||
const horizonalPodAutoscalerV2MetricParser = getInjectable({
|
|
||||||
id: "horizontal-pod-autoscaler-v2-metric-parser",
|
|
||||||
instantiate: () => {
|
|
||||||
return new HorizontalPodAutoscalerV2MetricParser();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default horizonalPodAutoscalerV2MetricParser;
|
|
||||||
Reference in new issue
Block a user