UNPKG

@alauda-fe/custom-resource-quota

Version:

custom resource

114 lines (113 loc) 3.21 kB
import { KubernetesResource, StringMap, TranslateKey } from '@alauda-fe/common'; export declare enum QuotaItemType { PODS = "pods", CPU_LIMITS = "limits.cpu", CPU_REQUESTS = "requests.cpu", MEMORY_LIMITS = "limits.memory", MEMORY_REQUESTS = "requests.memory", STORAGE_REQUESTS = "requests.storage", PVC = "persistentvolumeclaims", NVIDIA_GPU = "requests.nvidia.com/gpu", AMD_GPU = "requests.amd.com/gpu", TENCENT_VCUDA_CORE = "requests.tencent.com/vcuda-core", TENCENT_VCUDA_MEMORY = "requests.tencent.com/vcuda-memory" } export type K8sQuotaItem = Partial<Record<QuotaItemType, string>>; export type NamespaceOverviewSpecApiTypes = 'resourcequota' | 'application' | 'workload' | 'pod'; export interface K8sQuotaType { key: QuotaItemType; fallbackKey?: string; group?: string; nameInGroup?: string; nameInHint?: string; name: TranslateKey; unit: string; label?: string; unitOptions?: Array<Record<string, string>>; description?: TranslateKey; normalizer?: (value: string) => string | number; resourceUnit?: string; groupResources?: K8sQuotaType[]; excludeResources?: string; } export interface ResourceQuotaItem { cpu?: string; memory?: string; pods?: string; 'limits.cpu'?: string; 'requests.cpu'?: string; 'limits.memory'?: string; 'requests.memory'?: string; 'requests.storage'?: string; persistentvolumeclaims?: string; } export interface NamespaceOverviewAppStats { total: number; running: number; partialRunning: number; pending: number; failed: number; empty: number; stopped: number; } export interface NamespaceOverviewResourceQuota { parent?: ResourceQuotaItem; hard?: ResourceQuotaItem; used?: ResourceQuotaItem; } export interface WorkloadStats { ready: number; pending: number; stopped: number; } export interface PodError { name: string; status: string; reason: string; } export interface NamespaceOverviewSpec { application: NamespaceOverviewAppStats; resourceQuota: NamespaceOverviewResourceQuota; workload: { deployment: WorkloadStats; daemonset: WorkloadStats; statefulset: WorkloadStats; }; pod: { stats: { running: number; pending: number; error: number; succeeded: number; evicted: number; }; errors: PodError[]; }; } export type ResourceQuotaScope = 'Terminating' | 'NotTerminating' | 'BestEffort' | 'NotBestEffort'; export interface ResourceQuota extends KubernetesResource { spec?: ResourceQuotaSpec; } export interface ResourceQuotaSpec { hard?: StringMap; scopes?: ResourceQuotaScope[]; } export declare enum ActionType { CREATE = "create", UPDATE = "update", IMPORT = "import" } export interface CustomResourceData { key: string; unit?: string; descriptionEn: string; descriptionZh: string; labelEn?: string; labelZh?: string; relatedResources?: string; excludeResources?: string; group?: string; resourceUnit?: string; groupI18n?: string; groupResources?: K8sQuotaType[]; }