@backstage/plugin-kubernetes 0.6.6-next.0 → 0.6.6

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.6.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 4328737af6: Add support to fetch data for Stateful Sets and display an accordion in the same way as with Deployments
8
+ - b9b8bbc7d9: show request/limit CPU and Memory on the UI
9
+ - 5553f09e80: ability to configure refresh interval on Kubernetes tab
10
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
11
+ - 81304e3e91: Fix for HPA matching when deploying same HPA in multiple namespaces
12
+ - Updated dependencies
13
+ - @backstage/plugin-catalog-react@1.1.1
14
+ - @backstage/core-components@0.9.5
15
+ - @backstage/plugin-kubernetes-common@0.3.0
16
+ - @backstage/core-plugin-api@1.0.3
17
+ - @backstage/catalog-model@1.0.3
18
+
19
+ ## 0.6.6-next.2
20
+
21
+ ### Patch Changes
22
+
23
+ - 5553f09e80: ability to configure refresh interval on Kubernetes tab
24
+ - Updated dependencies
25
+ - @backstage/core-components@0.9.5-next.2
26
+
27
+ ## 0.6.6-next.1
28
+
29
+ ### Patch Changes
30
+
31
+ - b9b8bbc7d9: show request/limit CPU and Memory on the UI
32
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
33
+ - Updated dependencies
34
+ - @backstage/core-components@0.9.5-next.1
35
+ - @backstage/core-plugin-api@1.0.3-next.0
36
+ - @backstage/catalog-model@1.0.3-next.0
37
+ - @backstage/plugin-catalog-react@1.1.1-next.1
38
+ - @backstage/plugin-kubernetes-common@0.3.0-next.1
39
+
3
40
  ## 0.6.6-next.0
4
41
 
5
42
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -10,11 +10,23 @@ import React from 'react';
10
10
  declare const kubernetesPlugin: _backstage_core_plugin_api.BackstagePlugin<{
11
11
  entityContent: _backstage_core_plugin_api.RouteRef<undefined>;
12
12
  }, {}>;
13
- declare const EntityKubernetesContent: (_props: {}) => JSX.Element;
13
+ /**
14
+ * Props of EntityKubernetesContent
15
+ *
16
+ * @public
17
+ */
18
+ declare type EntityKubernetesContentProps = {
19
+ /**
20
+ * Sets the refresh interval in milliseconds. The default value is 10000 (10 seconds)
21
+ */
22
+ refreshIntervalMs?: number;
23
+ };
24
+ declare const EntityKubernetesContent: (props: EntityKubernetesContentProps) => JSX.Element;
14
25
 
15
26
  declare const isKubernetesAvailable: (entity: Entity) => boolean;
16
- declare type Props = {};
17
- declare const Router: (_props: Props) => JSX.Element;
27
+ declare const Router: (props: {
28
+ refreshIntervalMs?: number;
29
+ }) => JSX.Element;
18
30
 
19
31
  declare const kubernetesApiRef: _backstage_core_plugin_api.ApiRef<KubernetesApi>;
20
32
  interface KubernetesApi {
@@ -200,9 +212,10 @@ declare const ServicesAccordions: ({}: ServicesAccordionsProps) => JSX.Element;
200
212
 
201
213
  declare type KubernetesContentProps = {
202
214
  entity: Entity;
215
+ refreshIntervalMs?: number;
203
216
  children?: React.ReactNode;
204
217
  };
205
- declare const KubernetesContent: ({ entity }: KubernetesContentProps) => JSX.Element;
218
+ declare const KubernetesContent: ({ entity, refreshIntervalMs, }: KubernetesContentProps) => JSX.Element;
206
219
 
207
220
  interface KubernetesObjects {
208
221
  kubernetesObjects: ObjectsByEntityResponse | undefined;
@@ -218,4 +231,4 @@ declare const GroupedResponsesContext: React.Context<GroupedResponses>;
218
231
 
219
232
  declare const ClusterContext: React.Context<ClusterAttributes>;
220
233
 
221
- export { AwsKubernetesAuthProvider, Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, EntityKubernetesContent, ErrorPanel, ErrorReporting, GoogleKubernetesAuthProvider, GoogleServiceAccountAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesObjects, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServiceAccountKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin, useKubernetesObjects };
234
+ export { AwsKubernetesAuthProvider, Cluster, ClusterContext, ClusterLinksFormatter, ClusterLinksFormatterOptions, CronJobsAccordions, CustomResources, DeploymentResources, EntityKubernetesContent, EntityKubernetesContentProps, ErrorPanel, ErrorReporting, GoogleKubernetesAuthProvider, GoogleServiceAccountAuthProvider, GroupedResponses, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, JobsAccordions, KubernetesApi, KubernetesAuthProviders, KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesContent, KubernetesDrawer, KubernetesObjects, PodDrawer, PodNamesWithErrorsContext, PodNamesWithMetricsContext, PodsTable, Router, ServiceAccountKubernetesAuthProvider, ServicesAccordions, clusterLinksFormatters, formatClusterLink, isKubernetesAvailable, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesPlugin, kubernetesPlugin as plugin, useKubernetesObjects };
package/dist/index.esm.js CHANGED
@@ -440,6 +440,9 @@ const currentToDeclaredResourceToPerc = (current, resource) => {
440
440
  const denominator = BigInt(resource);
441
441
  return `${numerator * BigInt(100) / denominator}%`;
442
442
  };
443
+ const formatMilicores = (value) => {
444
+ return `${parseFloat(value.toString()) * 1e3}m`;
445
+ };
443
446
  const podStatusToCpuUtil = (podStatus) => {
444
447
  const cpuUtil = podStatus.cpu;
445
448
  let currentUsage = cpuUtil.currentUsage;
@@ -447,15 +450,18 @@ const podStatusToCpuUtil = (podStatus) => {
447
450
  currentUsage = cpuUtil.currentUsage / 10;
448
451
  }
449
452
  return /* @__PURE__ */ React__default.createElement(SubvalueCell, {
450
- value: `requests: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.requestTotal)}`,
451
- subvalue: `limits: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.limitTotal)}`
453
+ value: `requests: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.requestTotal)} of ${formatMilicores(cpuUtil.requestTotal)}`,
454
+ subvalue: `limits: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.limitTotal)} of ${formatMilicores(cpuUtil.limitTotal)}`
452
455
  });
453
456
  };
457
+ const bytesToMiB = (value) => {
458
+ return `${parseFloat(value.toString()) / 1024 / 1024}MiB`;
459
+ };
454
460
  const podStatusToMemoryUtil = (podStatus) => {
455
461
  const memUtil = podStatus.memory;
456
462
  return /* @__PURE__ */ React__default.createElement(SubvalueCell, {
457
- value: `requests: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.requestTotal)}`,
458
- subvalue: `limits: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.limitTotal)}`
463
+ value: `requests: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.requestTotal)} of ${bytesToMiB(memUtil.requestTotal)}`,
464
+ subvalue: `limits: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.limitTotal)} of ${bytesToMiB(memUtil.limitTotal)}`
459
465
  });
460
466
  };
461
467
 
@@ -2356,9 +2362,12 @@ const Cluster = ({ clusterObjects, podsWithErrors }) => {
2356
2362
  }, /* @__PURE__ */ React__default.createElement(CronJobsAccordions, null)))))))));
2357
2363
  };
2358
2364
 
2359
- const KubernetesContent = ({ entity }) => {
2365
+ const KubernetesContent = ({
2366
+ entity,
2367
+ refreshIntervalMs
2368
+ }) => {
2360
2369
  var _a;
2361
- const { kubernetesObjects, error } = useKubernetesObjects(entity);
2370
+ const { kubernetesObjects, error } = useKubernetesObjects(entity, refreshIntervalMs);
2362
2371
  const clustersWithErrors = (_a = kubernetesObjects == null ? void 0 : kubernetesObjects.items.filter((r) => r.errors.length > 0)) != null ? _a : [];
2363
2372
  const detectedErrors = kubernetesObjects !== void 0 ? detectErrors(kubernetesObjects) : /* @__PURE__ */ new Map();
2364
2373
  return /* @__PURE__ */ React__default.createElement(Page, {
@@ -2436,7 +2445,7 @@ const isKubernetesAvailable = (entity) => {
2436
2445
  var _a, _b;
2437
2446
  return Boolean((_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION]) || Boolean((_b = entity.metadata.annotations) == null ? void 0 : _b[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION]);
2438
2447
  };
2439
- const Router = (_props) => {
2448
+ const Router = (props) => {
2440
2449
  var _a, _b;
2441
2450
  const { entity } = useEntity();
2442
2451
  const kubernetesAnnotationValue = (_a = entity.metadata.annotations) == null ? void 0 : _a[KUBERNETES_ANNOTATION];
@@ -2445,7 +2454,8 @@ const Router = (_props) => {
2445
2454
  return /* @__PURE__ */ React__default.createElement(Routes, null, /* @__PURE__ */ React__default.createElement(Route, {
2446
2455
  path: "/",
2447
2456
  element: /* @__PURE__ */ React__default.createElement(KubernetesContent, {
2448
- entity
2457
+ entity,
2458
+ refreshIntervalMs: props.refreshIntervalMs
2449
2459
  })
2450
2460
  }));
2451
2461
  }