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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user