import { AccessMode, Condition, KubernetesResource, StringMap, Affinity, ResourceRequirements } from '@alauda-fe/common'; import { ReclaimPolicy, StorageProvisioner, VolumeBindingMode } from './commons'; export interface VolumeSnapshotClass extends KubernetesResource { driver: string; parameters?: StringMap; deletionPolicy?: string; } export interface VolumeSnapshot extends KubernetesResource { spec: VolumeSnapshotSpec; status?: { boundVolumeSnapshotContentName?: string; readyToUse?: boolean; error?: string; restoreSize?: string; }; } export interface VolumeSnapshotSpec { volumeSnapshotClassName: string; source?: { persistentVolumeClaimName?: string; }; } export interface StorageClass extends KubernetesResource { apiVersion: 'storage.k8s.io/v1'; kind: 'StorageClass'; mountOptions?: string[]; parameters?: StringMap; provisioner?: StorageProvisioner; reclaimPolicy?: ReclaimPolicy; volumeBindingMode?: VolumeBindingMode; allowVolumeExpansion?: boolean; } export interface BucketClass extends KubernetesResource { kind: 'BucketClass'; driverName: StorageProvisioner; deletionPolicy?: ReclaimPolicy; isDefaultBucketClass?: boolean; parameters?: StringMap; protocol?: { s3: { region: string; signatureVersion: string; }; }; } export type CommonStorageClass = StorageClass | BucketClass; export type CommonStorageClassKind = CommonStorageClass extends { kind: infer K; } ? K : never; export interface CephFSPersistentVolumeSource { monitors: string[]; path?: string; secretRef: SecretReference; user: string; } export interface SecretReference { name: string; namespace: string; } export interface PersistentVolumeSpec extends PersistentVolumeSpecMeta { accessModes: [AccessMode]; storageClassName?: string; } export interface PersistentVolume extends KubernetesResource { apiVersion: string; kind: string; spec: PersistentVolumeSpec; status?: { phase: string; }; } export interface PersistentVolumeSpecMeta { capacity: { storage: string; }; claimRef?: { apiVersion: string; kind: 'PersistentVolumeClaim'; name: string; namespace: string; uid: string; }; persistentVolumeReclaimPolicy: 'Retain' | 'Delete'; hostPath?: { path: string; }; nfs?: { server: string; path: string; }; cephfs?: CephFSPersistentVolumeSource; mountOptions?: string[]; csi?: { driver?: string; readOnly?: boolean; /** 该字段由UI生成, 需保证集群唯一, 可采用uuid */ volumeHandle?: string; volumeAttributes: { /** nfs 服务端地址 */ server: string; /** nfs 服务端fs目录 */ share: string; }; }; } export interface VolumeClaimTemplate extends KubernetesResource { spec: { accessModes: string[]; resources: { requests: { storage: string; }; }; storageClassName: string; }; } export interface CephClusterNetwork { ipFamily?: string; provider?: string; } export interface CephClusterStatus { ceph: { health: string; lastChecked: string; details: unknown; capacity?: { bytesAvailable: number; bytesTotal: number; bytesUsed: number; lastUpdated: string; }; }; conditions: Condition[]; message: string; phase: string; state: string; version: { image: string; version: string; }; storage: { deviceClasses: Array<{ name: string; }>; }; network: CephClusterNetwork; } declare const CephResourceConfigurationKeys: readonly ["mgr", "mon", "osd", "rbdmirror", "prepareosd", "crashcollector", "cleanup"]; export interface CephDashBoardSpec { enabled: boolean; urlPrefix?: string; port?: number; ssl?: boolean; } export interface StretchCluster { failureDomainLabel: string; subFailureDomain: string; zones: Array<{ name: string; arbiter?: boolean; }>; } export interface CephMonSettings { count: number; allowMultiplePerNode?: boolean; volumeClaimTemplate?: PersistentVolumeSpec; stretchCluster?: StretchCluster; } export interface CephMgrSettings { modules: Array<{ name: string; enabled: boolean; }>; count?: number; } export interface CephOsdConfiguration { metadataDevice?: string; storeType?: string; databaseSizeMB?: number; walSizeMB?: number; osdsPerDevice?: number; encryptedDevice?: boolean; deviceClass?: string; } export interface CephNodeSettings { name: string; config?: CephOsdConfiguration; useAllDevices?: boolean; deviceFilter?: RegExp; devicePathFilter?: RegExp; devices?: Array<{ config?: { deviceClass: string; }; name: string; }>; } export interface CephDisruptionManagement { managePodBudgets?: boolean; osdMaintenanceTimeout?: number; manageMachineDisruptionBudgets?: boolean; machineDisruptionBudgetNamespace?: string; } export interface CephStorageSettings { useAllNodes?: boolean; nodes: CephNodeSettings[]; } declare const CephPlacementConfigurationKeys: readonly ["mgr", "mon", "rbdmirror", "cleanup", "all", "osd"]; export interface CephPlacementNodeAffinity { requiredDuringSchedulingIgnoredDuringExecution: { nodeSelectorTerms: Array<{ matchExpressions: Array<{ key: string; operator: 'In' | 'NotIn' | 'Exists' | 'DoesNotExist'; values?: string[]; }>; }>; }; } export interface CephPlacementConfiguration { nodeAffinity?: CephPlacementNodeAffinity; podAffinity?: Affinity; podAntiAffinity?: Affinity; tolerations?: any[]; topologySpreadConstraints?: any[]; } export interface CephClusterSpec { priorityClassNames?: StringMap; external?: { enable: boolean; }; cephVersion: { image: string; allowUnsupported?: boolean; }; dataDirHostPath: string; skipUpgradeChecks?: boolean; continueUpgradeAfterChecksEvenIfNotHealthy?: boolean; dashboard?: CephDashBoardSpec; mon: CephMonSettings; mgr?: CephMgrSettings; storage?: CephStorageSettings; removeOSDsIfOutAndSafeToRemove?: boolean; crashCollector?: { disable: boolean; }; network?: CephClusterNetwork; disruptionManagement?: CephDisruptionManagement; placement?: Partial[number], CephPlacementConfiguration>>; resources?: Partial[number], { requests: { cpu: string; memory: string; }; }>>; monitoring?: { enabled: boolean; ruleNamespace?: string; }; } export interface CephCluster extends KubernetesResource { spec: CephClusterSpec; status?: CephClusterStatus; } export interface CephObjectPoolSpec { name?: string; deviceClass?: string; failureDomain?: string; replicated: { size: number; requireSafeReplicaSize?: boolean; }; erasureCoded?: { dataChunks: number; codingChunks: number; }; quotas?: { maxSize?: string; }; parameters?: { compression_mode?: string; }; } export interface CephMetadataServer { activeCount: number; activeStandby?: boolean; placement?: CephPlacementConfiguration; resources: ResourceRequirements; } export interface CephFileSystem extends KubernetesResource { spec: { metadataPool?: any; dataPools?: CephObjectPoolSpec[]; preservePoolsOnDelete?: boolean; metadataServer?: CephMetadataServer; }; status?: { phase: string; }; } export interface CephBlockPool extends KubernetesResource { spec: { deviceClass?: string; failureDomain: string; replicated: { size: number; }; erasureCoded?: { dataChunks: number; codingChunks: number; }; parameters?: StringMap; quotas?: { maxSize?: string; }; }; status?: any; } export interface CephObjectStore extends KubernetesResource { spec: CephObjectStoreSpec; } export interface CephObjectStoreGateway { type: string; port: number; instances: number; placement: { nodeAffinity: CephPlacementNodeAffinity; }; annotations: unknown; resources: { limits: StringMap; }; } export interface CephObjectStoreSpec { metadataPool?: CephObjectPoolSpec; dataPool?: CephObjectPoolSpec; preservePoolsOnDelete?: boolean; gateway?: CephObjectStoreGateway; } export interface TopolvmNodeStorageStateClass { className: string; vgName: string; deviceStates?: Array<{ name: string; message?: string; state: 'Online' | 'Offline'; }>; state: 'Ready' | 'UnReady'; } export interface TopolvmClusterStatus { phase?: 'Ready' | 'Failure'; nodeStorageState?: Array<{ failClasses: TopolvmNodeStorageStateClass[]; successClasses: TopolvmNodeStorageStateClass[]; node: string; phase: 'Ready' | 'Failure' | 'Unknown' | 'Pending' | ''; }>; } export type TopolvmDeviceType = 'disk' | 'loop' | 'lvm'; export declare enum TopolvmClusterStorageDeviceClassStatusEnum { AVAILABLE = "available", NOT_AVAILABLE = "not_available" } export interface ThinPoolConfig { /** * Name specifies a name for the thin pool. */ name?: string; /** * OverProvisionRatio specifies a factor by which you can provision additional storage * based on the available storage in the thin pool. * To prevent over-provisioning through validation, set this field to 1. * Minimum: 1 */ overprovisionRatio: number; /** * ChunkSize specifies the statically calculated chunk size for the thin pool. * Used only when ChunkSizeCalculationPolicy = "Static". * Default: 128Ki if not set. * Range: 64Ki – 1Gi. * * Can be integer or string (e.g., "128Mi"). * // cspell: disable-next-line * Pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ */ chunkSize?: number | string; /** * ChunkSizeCalculationPolicy specifies how chunk size is determined. * - "Host": use the host lvm2 setting. * - "Static": use the ChunkSize value. * Default: "Static". */ chunkSizeCalculationPolicy?: 'Host' | 'Static'; /** * MetadataSize specifies metadata size for the thin pool. * Used only when MetadataSizeCalculationPolicy = "Static". * Default: 1Gi if not set. * Range: 2Mi – 16Gi. * * Can be integer or string (e.g., "1Gi"). * Pattern same as chunkSize. */ metadataSize?: number | string; /** * MetadataSizeCalculationPolicy specifies how metadata size is determined. * - "Host": use lvm2 default settings. * - "Static": use the MetadataSize value. * Default: "Host". */ metadataSizeCalculationPolicy?: 'Host' | 'Static'; /** * SizePercent specifies the percentage of space in the LVM volume group * for creating the thin pool. * Default: 90. * Range: 10 – 100. */ sizePercent?: number; } export interface TopolvmClusterSpecDeviceClassItem { className: string; default: boolean; volumeGroup: string; devices: Array<{ name: string; type: TopolvmDeviceType; }>; thinPoolConfig?: ThinPoolConfig; } export interface TopolvmClusterSpecDeviceClass { nodeName: string; classes: TopolvmClusterSpecDeviceClassItem[]; } export interface TopolvmClusterV2Spec { cleanup?: boolean; topolvmVersion: string; storage?: { deviceClasses: TopolvmClusterSpecDeviceClass[]; }; } export interface TopolvmClusterV2 extends KubernetesResource { spec: TopolvmClusterV2Spec; status?: TopolvmClusterStatus; } export declare enum HealthStatus { GREEN = "green", YELLOW = "yellow", RED = "red" } export declare enum PoolState { POOL_NOT_CREATED = "PoolNotCreated", POOL_CREATED = "PoolCreated", POOL_INITIALIZED = "PoolInitialized" } export interface MinioClusterStatus { currentState: string; healthStatus: HealthStatus; drivesOnline: number; pools: Array<{ ssName: string; state: PoolState; }>; usage: { capacity: number; usage: number; rawCapacity: number; rawUsage: number; }; } export interface MinioClusterPool { affinity: { podAntiAffinity?: Affinity; nodeAffinity?: Affinity; }; name: string; servers: number; volumesPerServer: number; volumeClaimTemplate: VolumeClaimTemplate; tolerations?: Array<{ effect: string; operator: string; }>; resources?: { limits?: { cpu: string; memory: string; }; requests?: { cpu: string; memory: string; }; }; } export interface MinioClusterSpec { configuration: { name: string; }; credsSecret: { name: string; }; image?: string; requestAutoCert: boolean; pools: MinioClusterPool[]; externalCertSecret?: Array<{ name: string; type: string; }>; sideCars?: { resources: { limits?: { cpu: string; memory: string; }; requests?: { cpu: string; memory: string; }; }; }; } export interface MinioCluster extends KubernetesResource { spec: MinioClusterSpec; status?: MinioClusterStatus; } export {};