kubernetes-common

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 15:42:12 +02:00
parent 75a5e29489
commit 4ad7c48684
3 changed files with 25 additions and 51 deletions
+25
View File
@@ -31,6 +31,7 @@ import {
} from '@kubernetes/client-node';
import { Entity } from '@backstage/catalog-model';
/** @public */
export interface KubernetesRequestAuth {
google?: string;
oidc?: {
@@ -38,11 +39,13 @@ export interface KubernetesRequestAuth {
};
}
/** @public */
export interface KubernetesRequestBody {
auth?: KubernetesRequestAuth;
entity: Entity;
}
/** @public */
export interface ClusterAttributes {
/**
* Specifies the name of the Kubernetes cluster.
@@ -81,6 +84,7 @@ export interface ClusterAttributes {
dashboardParameters?: JsonObject;
}
/** @public */
export interface ClusterObjects {
cluster: ClusterAttributes;
resources: FetchResponse[];
@@ -88,12 +92,15 @@ export interface ClusterObjects {
errors: KubernetesFetchError[];
}
/** @public */
export interface ObjectsByEntityResponse {
items: ClusterObjects[];
}
/** @public */
export type AuthProviderType = 'google' | 'serviceAccount' | 'aws' | 'azure';
/** @public */
export type FetchResponse =
| PodFetchResponse
| ServiceFetchResponse
@@ -109,95 +116,113 @@ export type FetchResponse =
| StatefulSetsFetchResponse
| DaemonSetsFetchResponse;
/** @public */
export interface PodFetchResponse {
type: 'pods';
resources: Array<V1Pod>;
}
/** @public */
export interface ServiceFetchResponse {
type: 'services';
resources: Array<V1Service>;
}
/** @public */
export interface ConfigMapFetchResponse {
type: 'configmaps';
resources: Array<V1ConfigMap>;
}
/** @public */
export interface DeploymentFetchResponse {
type: 'deployments';
resources: Array<V1Deployment>;
}
/** @public */
export interface ReplicaSetsFetchResponse {
type: 'replicasets';
resources: Array<V1ReplicaSet>;
}
/** @public */
export interface LimitRangeFetchReponse {
type: 'limitranges';
resources: Array<V1LimitRange>;
}
/** @public */
export interface HorizontalPodAutoscalersFetchResponse {
type: 'horizontalpodautoscalers';
resources: Array<V1HorizontalPodAutoscaler>;
}
/** @public */
export interface JobsFetchResponse {
type: 'jobs';
resources: Array<V1Job>;
}
/** @public */
export interface CronJobsFetchResponse {
type: 'cronjobs';
resources: Array<V1CronJob>;
}
/** @public */
export interface IngressesFetchResponse {
type: 'ingresses';
resources: Array<V1Ingress>;
}
/** @public */
export interface CustomResourceFetchResponse {
type: 'customresources';
resources: Array<any>;
}
/** @public */
export interface StatefulSetsFetchResponse {
type: 'statefulsets';
resources: Array<V1StatefulSet>;
}
/** @public */
export interface DaemonSetsFetchResponse {
type: 'daemonsets';
resources: Array<V1DaemonSet>;
}
/** @public */
export interface KubernetesFetchError {
errorType: KubernetesErrorTypes;
statusCode?: number;
resourcePath?: string;
}
/** @public */
export type KubernetesErrorTypes =
| 'BAD_REQUEST'
| 'UNAUTHORIZED_ERROR'
| 'SYSTEM_ERROR'
| 'UNKNOWN_ERROR';
/** @public */
export interface ClientCurrentResourceUsage {
currentUsage: number | string;
requestTotal: number | string;
limitTotal: number | string;
}
/** @public */
export interface ClientContainerStatus {
container: string;
cpuUsage: ClientCurrentResourceUsage;
memoryUsage: ClientCurrentResourceUsage;
}
/** @public */
export interface ClientPodStatus {
pod: V1Pod;
cpu: ClientCurrentResourceUsage;