@k8slens/extensions 6.0.1-git.04652b4f90.0 → 6.0.1-git.06d780479c.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30648,7 +30648,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
30648
30648
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
30649
30649
 
30650
30650
  "use strict";
30651
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HorizontalPodAutoscaler\": () => (/* binding */ HorizontalPodAutoscaler),\n/* harmony export */ \"HorizontalPodAutoscalerApi\": () => (/* binding */ HorizontalPodAutoscalerApi),\n/* harmony export */ \"HpaMetricType\": () => (/* binding */ HpaMetricType)\n/* harmony export */ });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/**\n * Copyright (c) OpenLens Authors. All rights reserved.\n * Licensed under MIT License. See LICENSE in root directory for more information.\n */\n\n\nvar HpaMetricType;\n(function (HpaMetricType) {\n HpaMetricType[\"Resource\"] = \"Resource\";\n HpaMetricType[\"Pods\"] = \"Pods\";\n HpaMetricType[\"Object\"] = \"Object\";\n HpaMetricType[\"External\"] = \"External\";\n HpaMetricType[\"ContainerResource\"] = \"ContainerResource\";\n})(HpaMetricType || (HpaMetricType = {}));\nclass HorizontalPodAutoscaler extends _kube_object__WEBPACK_IMPORTED_MODULE_0__.KubeObject {\n getMaxPods() {\n var _a;\n return (_a = this.spec.maxReplicas) !== null && _a !== void 0 ? _a : 0;\n }\n getMinPods() {\n var _a;\n return (_a = this.spec.minReplicas) !== null && _a !== void 0 ? _a : 0;\n }\n getReplicas() {\n var _a, _b;\n return (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.currentReplicas) !== null && _b !== void 0 ? _b : 0;\n }\n getReadyConditions() {\n return this.getConditions().filter(({ isReady }) => isReady);\n }\n getConditions() {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.conditions) === null || _b === void 0 ? void 0 : _b.map(condition => {\n const { message, reason, lastTransitionTime, status } = condition;\n return {\n ...condition,\n isReady: status === \"True\",\n tooltip: `${message || reason} (${lastTransitionTime})`,\n };\n })) !== null && _c !== void 0 ? _c : [];\n }\n getMetrics() {\n var _a;\n return (_a = this.spec.metrics) !== null && _a !== void 0 ? _a : [];\n }\n getCurrentMetrics() {\n var _a, _b;\n return (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.currentMetrics) !== null && _b !== void 0 ? _b : [];\n }\n getMetricValues(metric) {\n const { current = \"unknown\", target = \"unknown\", } = getMetricCurrentTarget(metric, this.getCurrentMetrics());\n return `${current} / ${target}`;\n }\n}\nObject.defineProperty(HorizontalPodAutoscaler, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"HorizontalPodAutoscaler\"\n});\nObject.defineProperty(HorizontalPodAutoscaler, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n});\nObject.defineProperty(HorizontalPodAutoscaler, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/apis/autoscaling/v2beta1/horizontalpodautoscalers\"\n});\nclass HorizontalPodAutoscalerApi extends _kube_api__WEBPACK_IMPORTED_MODULE_1__.KubeApi {\n constructor(opts) {\n super({\n objectConstructor: HorizontalPodAutoscaler,\n ...opts !== null && opts !== void 0 ? opts : {},\n });\n }\n}\nfunction getMetricName(metric) {\n switch (metric.type) {\n case HpaMetricType.Resource:\n return metric.resource.name;\n case HpaMetricType.Pods:\n return metric.pods.metricName;\n case HpaMetricType.Object:\n return metric.object.metricName;\n case HpaMetricType.External:\n return metric.external.metricName;\n case HpaMetricType.ContainerResource:\n return metric.containerResource.name;\n default:\n return undefined;\n }\n}\nfunction getResourceMetricValue(currentMetric, targetMetric) {\n return {\n current: ((currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageUtilization)\n ? `${currentMetric.currentAverageUtilization}%`\n : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: ((targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageUtilization)\n ? `${targetMetric.targetAverageUtilization}%`\n : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getPodsMetricValue(currentMetric, targetMetric) {\n return {\n current: currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue,\n target: targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue,\n };\n}\nfunction getObjectMetricValue(currentMetric, targetMetric) {\n var _a, _b;\n return {\n current: ((_a = currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentValue) !== null && _a !== void 0 ? _a : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.averageValue),\n target: ((_b = targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetValue) !== null && _b !== void 0 ? _b : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.averageValue),\n };\n}\nfunction getExternalMetricValue(currentMetric, targetMetric) {\n var _a, _b;\n return {\n current: ((_a = currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentValue) !== null && _a !== void 0 ? _a : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: ((_b = targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetValue) !== null && _b !== void 0 ? _b : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getContainerResourceMetricValue(currentMetric, targetMetric) {\n return {\n current: ((currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageUtilization)\n ? `${currentMetric.currentAverageUtilization}%`\n : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: ((targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageUtilization)\n ? `${targetMetric.targetAverageUtilization}%`\n : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getMetricCurrentTarget(spec, status) {\n const currentMetric = status.find(m => (m.type === spec.type\n && getMetricName(m) === getMetricName(spec)));\n switch (spec.type) {\n case HpaMetricType.Resource:\n return getResourceMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.resource, spec.resource);\n case HpaMetricType.Pods:\n return getPodsMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.pods, spec.pods);\n case HpaMetricType.Object:\n return getObjectMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.object, spec.object);\n case HpaMetricType.External:\n return getExternalMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.external, spec.external);\n case HpaMetricType.ContainerResource:\n return getContainerResourceMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.containerResource, spec.containerResource);\n default:\n return {};\n }\n}\n\n\n//# sourceURL=webpack://open-lens/./src/common/k8s-api/endpoints/horizontal-pod-autoscaler.api.ts?");
30651
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"HorizontalPodAutoscaler\": () => (/* binding */ HorizontalPodAutoscaler),\n/* harmony export */ \"HorizontalPodAutoscalerApi\": () => (/* binding */ HorizontalPodAutoscalerApi),\n/* harmony export */ \"HpaMetricType\": () => (/* binding */ HpaMetricType)\n/* harmony export */ });\n/* harmony import */ var _kube_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../kube-object */ \"./src/common/k8s-api/kube-object.ts\");\n/* harmony import */ var _kube_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../kube-api */ \"./src/common/k8s-api/kube-api.ts\");\n/**\n * Copyright (c) OpenLens Authors. All rights reserved.\n * Licensed under MIT License. See LICENSE in root directory for more information.\n */\n\n\nvar HpaMetricType;\n(function (HpaMetricType) {\n HpaMetricType[\"Resource\"] = \"Resource\";\n HpaMetricType[\"Pods\"] = \"Pods\";\n HpaMetricType[\"Object\"] = \"Object\";\n HpaMetricType[\"External\"] = \"External\";\n HpaMetricType[\"ContainerResource\"] = \"ContainerResource\";\n})(HpaMetricType || (HpaMetricType = {}));\nclass HorizontalPodAutoscaler extends _kube_object__WEBPACK_IMPORTED_MODULE_0__.KubeObject {\n getMaxPods() {\n var _a;\n return (_a = this.spec.maxReplicas) !== null && _a !== void 0 ? _a : 0;\n }\n getMinPods() {\n var _a;\n return (_a = this.spec.minReplicas) !== null && _a !== void 0 ? _a : 0;\n }\n getReplicas() {\n var _a, _b;\n return (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.currentReplicas) !== null && _b !== void 0 ? _b : 0;\n }\n getReadyConditions() {\n return this.getConditions().filter(({ isReady }) => isReady);\n }\n getConditions() {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.conditions) === null || _b === void 0 ? void 0 : _b.map(condition => {\n const { message, reason, lastTransitionTime, status } = condition;\n return {\n ...condition,\n isReady: status === \"True\",\n tooltip: `${message || reason} (${lastTransitionTime})`,\n };\n })) !== null && _c !== void 0 ? _c : [];\n }\n getMetrics() {\n var _a;\n return (_a = this.spec.metrics) !== null && _a !== void 0 ? _a : [];\n }\n getCurrentMetrics() {\n var _a, _b;\n return (_b = (_a = this.status) === null || _a === void 0 ? void 0 : _a.currentMetrics) !== null && _b !== void 0 ? _b : [];\n }\n getMetricValues(metric) {\n const { current = \"unknown\", target = \"unknown\", } = getMetricCurrentTarget(metric, this.getCurrentMetrics());\n return `${current} / ${target}`;\n }\n}\nObject.defineProperty(HorizontalPodAutoscaler, \"kind\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"HorizontalPodAutoscaler\"\n});\nObject.defineProperty(HorizontalPodAutoscaler, \"namespaced\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: true\n});\nObject.defineProperty(HorizontalPodAutoscaler, \"apiBase\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: \"/apis/autoscaling/v2beta1/horizontalpodautoscalers\"\n});\nclass HorizontalPodAutoscalerApi extends _kube_api__WEBPACK_IMPORTED_MODULE_1__.KubeApi {\n constructor(opts) {\n super({\n objectConstructor: HorizontalPodAutoscaler,\n ...opts !== null && opts !== void 0 ? opts : {},\n });\n }\n}\nfunction getMetricName(metric) {\n switch (metric.type) {\n case HpaMetricType.Resource:\n return metric.resource.name;\n case HpaMetricType.Pods:\n return metric.pods.metricName;\n case HpaMetricType.Object:\n return metric.object.metricName;\n case HpaMetricType.External:\n return metric.external.metricName;\n case HpaMetricType.ContainerResource:\n return metric.containerResource.name;\n default:\n return undefined;\n }\n}\nfunction getResourceMetricValue(currentMetric, targetMetric) {\n return {\n current: (typeof (currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageUtilization) === \"number\"\n ? `${currentMetric.currentAverageUtilization}%`\n : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: (typeof (targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageUtilization) === \"number\"\n ? `${targetMetric.targetAverageUtilization}%`\n : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getPodsMetricValue(currentMetric, targetMetric) {\n return {\n current: currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue,\n target: targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue,\n };\n}\nfunction getObjectMetricValue(currentMetric, targetMetric) {\n var _a, _b;\n return {\n current: ((_a = currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentValue) !== null && _a !== void 0 ? _a : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.averageValue),\n target: ((_b = targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetValue) !== null && _b !== void 0 ? _b : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.averageValue),\n };\n}\nfunction getExternalMetricValue(currentMetric, targetMetric) {\n var _a, _b;\n return {\n current: ((_a = currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentValue) !== null && _a !== void 0 ? _a : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: ((_b = targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetValue) !== null && _b !== void 0 ? _b : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getContainerResourceMetricValue(currentMetric, targetMetric) {\n return {\n current: (typeof (currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageUtilization) === \"number\"\n ? `${currentMetric.currentAverageUtilization}%`\n : currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.currentAverageValue),\n target: (typeof (targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageUtilization) === \"number\"\n ? `${targetMetric.targetAverageUtilization}%`\n : targetMetric === null || targetMetric === void 0 ? void 0 : targetMetric.targetAverageValue),\n };\n}\nfunction getMetricCurrentTarget(spec, status) {\n const currentMetric = status.find(m => (m.type === spec.type\n && getMetricName(m) === getMetricName(spec)));\n switch (spec.type) {\n case HpaMetricType.Resource:\n return getResourceMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.resource, spec.resource);\n case HpaMetricType.Pods:\n return getPodsMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.pods, spec.pods);\n case HpaMetricType.Object:\n return getObjectMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.object, spec.object);\n case HpaMetricType.External:\n return getExternalMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.external, spec.external);\n case HpaMetricType.ContainerResource:\n return getContainerResourceMetricValue(currentMetric === null || currentMetric === void 0 ? void 0 : currentMetric.containerResource, spec.containerResource);\n default:\n return {};\n }\n}\n\n\n//# sourceURL=webpack://open-lens/./src/common/k8s-api/endpoints/horizontal-pod-autoscaler.api.ts?");
30652
30652
 
30653
30653
  /***/ }),
30654
30654
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@k8slens/extensions",
3
3
  "productName": "OpenLens extensions",
4
4
  "description": "OpenLens - Open Source Kubernetes IDE: extensions",
5
- "version": "6.0.1-git.04652b4f90.0",
5
+ "version": "6.0.1-git.06d780479c.0",
6
6
  "copyright": "© 2022 OpenLens Authors",
7
7
  "license": "MIT",
8
8
  "main": "dist/src/extensions/extension-api.js",