Handle the error when fetching pod metrics

Include the `PodStatus` into the `FetchResponse` union type. Now the method `fetchPodMetricsByNamespaces` accepts a set of namespaces and return a `FetchResponseWrapper`, which is consistent with other public fetch methods.

The Kubernetes errors happened when fetching pod metrics is now captured and returned to the frontend.

Signed-off-by: Mengnan Gong <namco1992@gmail.com>
This commit is contained in:
Mengnan Gong
2022-10-03 14:42:33 +08:00
parent aab0c03977
commit cbf5d11fdf
9 changed files with 118 additions and 64 deletions
+9 -1
View File
@@ -16,6 +16,7 @@
import type { JsonObject } from '@backstage/types';
import {
PodStatus,
V1ConfigMap,
V1CronJob,
V1DaemonSet,
@@ -134,7 +135,8 @@ export type FetchResponse =
| IngressesFetchResponse
| CustomResourceFetchResponse
| StatefulSetsFetchResponse
| DaemonSetsFetchResponse;
| DaemonSetsFetchResponse
| PodStatusFetchResponse;
/** @public */
export interface PodFetchResponse {
@@ -214,6 +216,12 @@ export interface DaemonSetsFetchResponse {
resources: Array<V1DaemonSet>;
}
/** @public */
export interface PodStatusFetchResponse {
type: 'podstatus';
resources: Array<PodStatus>;
}
/** @public */
export interface KubernetesFetchError {
errorType: KubernetesErrorTypes;