@alauda-fe/storage 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/esm2022/alauda-fe-storage.mjs +5 -0
  2. package/esm2022/index.mjs +23 -0
  3. package/esm2022/lib/components/pvc-delete-dialog/component.mjs +292 -0
  4. package/esm2022/lib/components/pvc-expand-capacity-dialog/component.mjs +193 -0
  5. package/esm2022/lib/components/pvc-form/component.mjs +674 -0
  6. package/esm2022/lib/components/rebuild-volume-dialog/component.mjs +251 -0
  7. package/esm2022/lib/components/source-link/component.mjs +81 -0
  8. package/esm2022/lib/components/spec-form/component.mjs +464 -0
  9. package/esm2022/lib/components/storage-feature-tags/component.mjs +146 -0
  10. package/esm2022/lib/components/storageclass-select/component.mjs +179 -0
  11. package/esm2022/lib/pipes/actual-capacity.pipe.mjs +17 -0
  12. package/esm2022/lib/services/common-util.service.mjs +163 -0
  13. package/esm2022/lib/services/pvc-util.service.mjs +416 -0
  14. package/esm2022/lib/types/commons.mjs +75 -0
  15. package/esm2022/lib/types/internal.mjs +7 -0
  16. package/esm2022/lib/types/k8s.mjs +2 -0
  17. package/esm2022/lib/types/resource-definition.mjs +13 -0
  18. package/esm2022/lib/types/resource-exports.mjs +8 -0
  19. package/esm2022/lib/types/resource-internals.mjs +2 -0
  20. package/esm2022/lib/utils/constants.mjs +202 -0
  21. package/esm2022/lib/utils/resource-exports.mjs +65 -0
  22. package/esm2022/lib/utils/util.mjs +132 -0
  23. package/index.d.ts +17 -0
  24. package/lib/components/pvc-delete-dialog/component.d.ts +33 -0
  25. package/lib/components/pvc-expand-capacity-dialog/component.d.ts +36 -0
  26. package/lib/components/pvc-form/component.d.ts +106 -0
  27. package/lib/components/rebuild-volume-dialog/component.d.ts +28 -0
  28. package/lib/components/source-link/component.d.ts +17 -0
  29. package/lib/components/spec-form/component.d.ts +71 -0
  30. package/lib/components/storage-feature-tags/component.d.ts +25 -0
  31. package/lib/components/storageclass-select/component.d.ts +26 -0
  32. package/lib/pipes/actual-capacity.pipe.d.ts +8 -0
  33. package/lib/services/common-util.service.d.ts +48 -0
  34. package/lib/services/pvc-util.service.d.ts +130 -0
  35. package/lib/types/commons.d.ts +85 -0
  36. package/lib/types/internal.d.ts +4 -0
  37. package/lib/types/k8s.d.ts +105 -0
  38. package/lib/types/resource-definition.d.ts +18 -0
  39. package/lib/types/resource-exports.d.ts +16 -0
  40. package/lib/types/resource-internals.d.ts +20 -0
  41. package/lib/utils/constants.d.ts +37 -0
  42. package/lib/utils/resource-exports.d.ts +12 -0
  43. package/lib/utils/util.d.ts +19 -0
  44. package/package.json +38 -0
@@ -0,0 +1,106 @@
1
+ import { AccessMode, VolumeMode, LabelSelector, PersistentVolumeClaim, PersistentVolumeClaimDataSource, TranslateService, K8sApiService, ValueOf, StringMap, WorkspaceParams } from '@alauda-fe/common';
2
+ import { Observable } from 'rxjs';
3
+ import { StorageSelectOption, StorageCommonUtilService } from '../../services/common-util.service';
4
+ import { StorageClass, VolumeSnapshotClass } from '../../types/k8s';
5
+ import * as i0 from "@angular/core";
6
+ declare const PvcStorageClassCreateType: {
7
+ readonly DYNAMIC: "dynamic";
8
+ readonly STATIC: "static";
9
+ };
10
+ type PvcStorageClassCreateType = ValueOf<typeof PvcStorageClassCreateType>;
11
+ interface PersistentVolumeFormModel {
12
+ name: string;
13
+ labels: StringMap;
14
+ annotations: StringMap;
15
+ storageClassName: string;
16
+ accessModes: AccessMode;
17
+ volumeMode: VolumeMode;
18
+ storage: string;
19
+ dataSource?: PersistentVolumeClaimDataSource;
20
+ selector: LabelSelector;
21
+ }
22
+ type DisplayField = keyof PersistentVolumeFormModel | 'createType';
23
+ declare const PersistentVolumeClaimFormComponent_base: new () => import("@alauda-fe/common").BaseNestedFormControl<PersistentVolumeClaim, PersistentVolumeFormModel>;
24
+ export declare class PersistentVolumeClaimFormComponent extends PersistentVolumeClaimFormComponent_base {
25
+ protected storageCommonUtil: StorageCommonUtilService;
26
+ private readonly translate;
27
+ private readonly k8sApi;
28
+ baseParams: WorkspaceParams;
29
+ baseParams$: Observable<WorkspaceParams>;
30
+ storageClasses: StorageClass[];
31
+ storageClasses$: Observable<StorageClass[]>;
32
+ isFromSnapshot: boolean;
33
+ createType: PvcStorageClassCreateType;
34
+ volumeMode: VolumeMode;
35
+ displayFields: DisplayField[];
36
+ get showAdvancedField(): boolean;
37
+ accessModes: ("ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany")[];
38
+ volumeModes: ("Filesystem" | "Block")[];
39
+ POSITIVE_INT_PATTERN: {
40
+ pattern: RegExp;
41
+ tip: string;
42
+ };
43
+ model: PersistentVolumeFormModel;
44
+ resourceNameReg: {
45
+ pattern: RegExp;
46
+ tip: string;
47
+ };
48
+ labelValidator: {
49
+ key: typeof import("@alauda-fe/common").k8sResourceLabelKeyValidator;
50
+ value: import("@angular/forms").ValidatorFn;
51
+ };
52
+ AccessModeTranslateKey: {
53
+ ReadWriteOnce: string;
54
+ ReadOnlyMany: string;
55
+ ReadWriteMany: string;
56
+ };
57
+ VolumeModeTranslateKey: {
58
+ Filesystem: string;
59
+ Block: string;
60
+ };
61
+ labelErrorMapper$: Observable<{
62
+ key: {
63
+ namePattern: string;
64
+ prefixPattern: string;
65
+ nameTooLong: string;
66
+ prefixTooLong: string;
67
+ };
68
+ value: {
69
+ pattern: string;
70
+ maxlength: string;
71
+ };
72
+ }>;
73
+ annotationValidator: {
74
+ key: typeof import("@alauda-fe/common").k8sResourceLabelKeyValidator;
75
+ };
76
+ annotationErrorMapper$: Observable<{
77
+ key: {
78
+ namePattern: string;
79
+ prefixPattern: string;
80
+ nameTooLong: string;
81
+ prefixTooLong: string;
82
+ };
83
+ }>;
84
+ createMethod: PvcStorageClassCreateType;
85
+ PvcStorageClassCreateType: {
86
+ readonly DYNAMIC: "dynamic";
87
+ readonly STATIC: "static";
88
+ };
89
+ selectedStorageSelectOption: StorageSelectOption;
90
+ UNITS: readonly ["Gi", "Ti"];
91
+ unit: string;
92
+ storageClassList$: Observable<StorageClass[]>;
93
+ volumeSnapshotClassList$: Observable<VolumeSnapshotClass[]>;
94
+ writeValue(value: PersistentVolumeClaim): void;
95
+ constructor(storageCommonUtil: StorageCommonUtilService, translate: TranslateService, k8sApi: K8sApiService);
96
+ createMethodChange(createType: PvcStorageClassCreateType): void;
97
+ storageclassChange(selectedOption: StorageSelectOption): void;
98
+ displayFieldSupported(fieldName: DisplayField): boolean;
99
+ private setAccessModeToSupportValueIfNeed;
100
+ private setVolumeModeToSupportValueIfNeed;
101
+ private readonly adaptResourceModel;
102
+ private readonly overrideResource;
103
+ static ɵfac: i0.ɵɵFactoryDeclaration<PersistentVolumeClaimFormComponent, never>;
104
+ static ɵcmp: i0.ɵɵComponentDeclaration<PersistentVolumeClaimFormComponent, "acl-pvc-form", never, { "baseParams": { "alias": "baseParams"; "required": true; }; "storageClasses": { "alias": "storageClasses"; "required": false; }; "isFromSnapshot": { "alias": "isFromSnapshot"; "required": false; }; "createType": { "alias": "createType"; "required": false; }; "volumeMode": { "alias": "volumeMode"; "required": false; }; "displayFields": { "alias": "displayFields"; "required": false; }; }, {}, never, never, true, never>;
105
+ }
106
+ export {};
@@ -0,0 +1,28 @@
1
+ import { DialogRef } from '@alauda/ui';
2
+ import { K8sApiService, PersistentVolumeClaim, ResourceType } from '@alauda-fe/common';
3
+ import { BehaviorSubject } from 'rxjs';
4
+ import { PVCUtilService } from '../../services/pvc-util.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class RebuildVolumeDialogComponent {
7
+ readonly modalData: {
8
+ cluster: string;
9
+ namespace: string;
10
+ pvc: PersistentVolumeClaim;
11
+ };
12
+ private readonly k8sApi;
13
+ private readonly dialogRef;
14
+ protected readonly pvcUtil: PVCUtilService;
15
+ COLUMNS: string[];
16
+ inputValue: string;
17
+ submitting$$: BehaviorSubject<boolean>;
18
+ loading$$: BehaviorSubject<boolean>;
19
+ pods$: import("rxjs").Observable<import("@alauda-fe/common").Pod[]>;
20
+ constructor(modalData: {
21
+ cluster: string;
22
+ namespace: string;
23
+ pvc: PersistentVolumeClaim;
24
+ }, k8sApi: K8sApiService<ResourceType>, dialogRef: DialogRef, pvcUtil: PVCUtilService);
25
+ confirm(): void;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<RebuildVolumeDialogComponent, never>;
27
+ static ɵcmp: i0.ɵɵComponentDeclaration<RebuildVolumeDialogComponent, "ng-component", never, {}, {}, never, never, true, never>;
28
+ }
@@ -0,0 +1,17 @@
1
+ import { TranslateService } from '@alauda-fe/common';
2
+ import * as i0 from "@angular/core";
3
+ interface SourceLink {
4
+ name?: string;
5
+ routerLink?: string[];
6
+ kind?: string;
7
+ apiVersion?: string;
8
+ }
9
+ export declare class SourceLinkComponent {
10
+ translate: TranslateService;
11
+ sourceLink: SourceLink;
12
+ formatSourceLinkFn: (sourceLink: SourceLink, _locale?: string) => string;
13
+ constructor(translate: TranslateService);
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<SourceLinkComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<SourceLinkComponent, "acl-source-link", never, { "sourceLink": { "alias": "sourceLink"; "required": true; }; "formatSourceLinkFn": { "alias": "formatSourceLinkFn"; "required": false; }; }, {}, never, never, true, never>;
16
+ }
17
+ export {};
@@ -0,0 +1,71 @@
1
+ import { StringMap, TranslateService } from '@alauda-fe/common';
2
+ import { Injector, OnInit, TemplateRef } from '@angular/core';
3
+ import { ValidatorFn } from '@angular/forms';
4
+ import { BaseResourceFormGroupComponent } from 'ng-resource-form-util';
5
+ import { ResourceSize, ResourceSizeTip, ResourceSpecification } from '../../types/resource-exports';
6
+ import { ResourceRequirements } from '../../types/resource-internals';
7
+ import * as i0 from "@angular/core";
8
+ interface ResourceValidatorFn {
9
+ limits?: {
10
+ cpu: ValidatorFn[];
11
+ memory: ValidatorFn[];
12
+ };
13
+ requests?: {
14
+ cpu: ValidatorFn[];
15
+ memory: ValidatorFn[];
16
+ };
17
+ }
18
+ export declare class ResourceSpecFormComponent extends BaseResourceFormGroupComponent<ResourceRequirements, ResourceSpecification> implements OnInit {
19
+ private readonly translate;
20
+ resourceSizeTips: ResourceSizeTip[];
21
+ resourceSpecificationDescription: string | TemplateRef<any>;
22
+ resourceSpecification: ResourceSpecification[];
23
+ showResourceRequests: boolean;
24
+ validatorFn: ResourceValidatorFn;
25
+ set errorMapper(errorMapper: StringMap);
26
+ get errorMapper(): StringMap;
27
+ get resourceSpecificationMapper(): Partial<Record<ResourceSize, ResourceSpecification>>;
28
+ private _errorMapper;
29
+ ResourceSize: typeof ResourceSize;
30
+ POSITIVE_INT_PATTERN: {
31
+ pattern: RegExp;
32
+ tip: string;
33
+ };
34
+ isTemplateRef: (label: any) => label is TemplateRef<unknown>;
35
+ constructor(injector: Injector, translate: TranslateService);
36
+ ngOnInit(): void;
37
+ createForm(): import("@angular/forms").FormGroup<{
38
+ requests: import("@angular/forms").FormGroup<{
39
+ cpu: import("@angular/forms").FormGroup<{
40
+ value: import("@angular/forms").FormControl<number>;
41
+ unit: import("@angular/forms").FormControl<"core" | "m">;
42
+ }>;
43
+ memory: import("@angular/forms").FormGroup<{
44
+ value: import("@angular/forms").FormControl<number>;
45
+ unit: import("@angular/forms").FormControl<"Gi" | "Mi">;
46
+ }>;
47
+ }>;
48
+ size: import("@angular/forms").FormControl<ResourceSize>;
49
+ limits: import("@angular/forms").FormGroup<{
50
+ cpu: import("@angular/forms").FormGroup<{
51
+ value: import("@angular/forms").FormControl<number>;
52
+ unit: import("@angular/forms").FormControl<"core" | "m">;
53
+ }>;
54
+ memory: import("@angular/forms").FormGroup<{
55
+ value: import("@angular/forms").FormControl<number>;
56
+ unit: import("@angular/forms").FormControl<"Gi" | "Mi">;
57
+ }>;
58
+ }>;
59
+ }>;
60
+ getDefaultFormModel(): {
61
+ requests: import("../../types/resource-internals").ResourceModel;
62
+ size: ResourceSize;
63
+ limits: import("../../types/resource-internals").ResourceModel;
64
+ };
65
+ adaptFormModel(formModel: ResourceSpecification): ResourceRequirements;
66
+ adaptResourceModel(resource: ResourceRequirements): ResourceSpecification;
67
+ onResourceSizeChange(size: ResourceSize): void;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<ResourceSpecFormComponent, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<ResourceSpecFormComponent, "acl-resource-spec-form", never, { "resourceSizeTips": { "alias": "resourceSizeTips"; "required": true; }; "resourceSpecificationDescription": { "alias": "resourceSpecificationDescription"; "required": false; }; "resourceSpecification": { "alias": "resourceSpecification"; "required": false; }; "showResourceRequests": { "alias": "showResourceRequests"; "required": false; }; "validatorFn": { "alias": "validatorFn"; "required": false; }; "errorMapper": { "alias": "errorMapper"; "required": false; }; }, {}, never, never, true, never>;
70
+ }
71
+ export {};
@@ -0,0 +1,25 @@
1
+ import { K8sUtilService } from '@alauda-fe/common';
2
+ import { Observable } from 'rxjs';
3
+ import { StorageCommonUtilService } from '../../services/common-util.service';
4
+ import { StorageProvisioner, StorageclassFeature } from '../../types/commons';
5
+ import { StorageClass, VolumeSnapshotClass } from '../../types/k8s';
6
+ import * as i0 from "@angular/core";
7
+ export declare class StorageFeatureTagsComponent {
8
+ private readonly k8sUtil;
9
+ private readonly storageUtil;
10
+ provisioner: StorageProvisioner;
11
+ provisioner$: Observable<StorageProvisioner>;
12
+ storageClass: StorageClass;
13
+ storageClass$: Observable<StorageClass>;
14
+ hasDefault: boolean;
15
+ volumeSnapshotClasses: VolumeSnapshotClass[];
16
+ volumeSnapshotClasses$: Observable<VolumeSnapshotClass[]>;
17
+ features$: Observable<StorageclassFeature[]>;
18
+ constructor(k8sUtil: K8sUtilService, storageUtil: StorageCommonUtilService);
19
+ private updateStorageClassFeature;
20
+ private updateVolumeSnapshotFeature;
21
+ private hasVolumeSnapshotFeature;
22
+ private updateThirdPartySnapshotFeature;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<StorageFeatureTagsComponent, never>;
24
+ static ɵcmp: i0.ɵɵComponentDeclaration<StorageFeatureTagsComponent, "acl-storage-feature-tags", never, { "provisioner": { "alias": "provisioner"; "required": true; }; "storageClass": { "alias": "storageClass"; "required": false; }; "hasDefault": { "alias": "hasDefault"; "required": false; }; "volumeSnapshotClasses": { "alias": "volumeSnapshotClasses"; "required": false; }; }, {}, never, never, true, never>;
25
+ }
@@ -0,0 +1,26 @@
1
+ import { AttrBoolean } from '@alauda/ui';
2
+ import { EventEmitter } from '@angular/core';
3
+ import { BaseResourceFormComponent } from 'ng-resource-form-util';
4
+ import { Observable } from 'rxjs';
5
+ import { StorageCommonUtilService, StorageSelectOption } from '../../services/common-util.service';
6
+ import { StorageClass, VolumeSnapshotClass } from '../../types/k8s';
7
+ import * as i0 from "@angular/core";
8
+ export declare class StorageClassSelectComponent extends BaseResourceFormComponent<string> {
9
+ storageClasses: StorageClass[];
10
+ storageClasses$: Observable<StorageClass[]>;
11
+ set required(value: AttrBoolean);
12
+ get required(): AttrBoolean;
13
+ volumeSnapshotClasses: VolumeSnapshotClass[];
14
+ selectDefault: boolean;
15
+ isFromSnapshot: boolean;
16
+ storageClassChange: EventEmitter<StorageSelectOption>;
17
+ storageCommonUtil: StorageCommonUtilService;
18
+ storageClassOptions$: Observable<StorageSelectOption[]>;
19
+ private _required;
20
+ createForm(): import("@angular/forms").FormControl<string>;
21
+ errorsInDetail: boolean;
22
+ getStorageClassOption(value: string, options?: StorageSelectOption[]): StorageSelectOption;
23
+ onStorageClassChange(storageClassName: string, storageClassOptions?: StorageSelectOption[]): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<StorageClassSelectComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<StorageClassSelectComponent, "acl-storageclass-select", never, { "storageClasses": { "alias": "storageClasses"; "required": true; }; "required": { "alias": "required"; "required": false; }; "volumeSnapshotClasses": { "alias": "volumeSnapshotClasses"; "required": false; }; "selectDefault": { "alias": "selectDefault"; "required": false; }; "isFromSnapshot": { "alias": "isFromSnapshot"; "required": false; }; }, { "storageClassChange": "storageClassChange"; }, never, never, true, never>;
26
+ }
@@ -0,0 +1,8 @@
1
+ import { PersistentVolumeClaim } from '@alauda-fe/common';
2
+ import { PipeTransform } from '@angular/core';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ActualCapacityPipe implements PipeTransform {
5
+ transform(value: PersistentVolumeClaim, withUnit?: boolean): string;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<ActualCapacityPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<ActualCapacityPipe, "rcActualCapacity", true>;
8
+ }
@@ -0,0 +1,48 @@
1
+ import { AccessMode, VolumeMode, K8sUtilService, K8sApiService, StringMap, CacheStore } from '@alauda-fe/common';
2
+ import { StorageclassFeature, StorageProvisioner } from '../types/commons';
3
+ import { CommonStorageClass, StorageClass } from '../types/k8s';
4
+ import * as i0 from "@angular/core";
5
+ export interface StorageSelectOption {
6
+ key: string;
7
+ value: string;
8
+ isDefault: boolean;
9
+ accessModes: AccessMode[];
10
+ features: StorageclassFeature[];
11
+ volumeModes: VolumeMode[];
12
+ provisioner: StorageProvisioner;
13
+ storageClass: StorageClass;
14
+ }
15
+ export declare class StorageCommonUtilService {
16
+ private readonly k8sUtil;
17
+ private readonly k8sApi;
18
+ readonly storageDescriptionMapCache: CacheStore<unknown, StringMap[]>;
19
+ constructor(k8sUtil: K8sUtilService, k8sApi: K8sApiService);
20
+ getStorageClassFeatures(storageClass: StorageClass): StorageclassFeature[];
21
+ isStorageClassFeatureSupported(storageclass: StorageClass, feature: StorageclassFeature): boolean;
22
+ mapToStorageClassOption(sc: StorageClass, storageDescriptionMaps?: StringMap[], isFromSnapshot?: boolean): StorageSelectOption;
23
+ isClusterSnapshotPluginEnabled$(cluster: string): import("rxjs").Observable<boolean>;
24
+ /**
25
+ * 获取第三方快照能力支持情况,若返回 null 表示未匹配到三方存储
26
+ */
27
+ getThirdPartySnapshotSupported(sc: CommonStorageClass, storageDescriptionMaps: StringMap[]): boolean | null;
28
+ getProvisionerType(sc: CommonStorageClass, storageDescriptionMaps: StringMap[]): string;
29
+ getStorageclassAccessModes(sc: CommonStorageClass, storageDescriptionMaps: StringMap[], isFromSnapshot: boolean): ("ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany")[];
30
+ getStorageclassVolumeModes(sc: CommonStorageClass, storageDescriptionMaps: StringMap[]): ("Filesystem" | "Block")[];
31
+ isAccessModeDisabled(accessMode: AccessMode, storageClassOption: StorageSelectOption): boolean;
32
+ isVolumeModeDisabled(volumeMode: VolumeMode, storageClassOption: StorageSelectOption): boolean;
33
+ private findStorageDescriptionMap;
34
+ private getThirdPartyStorageclassAccessModes;
35
+ private getThirdPartyStorageclassVolumeModes;
36
+ /**
37
+ * 解析 ConfigMap 中的 AccessModes 和 VolumeModes, 要求 cm 中的配置不区分大小,满足 AccessModes 或 VolumeModes 中定义即可
38
+ *
39
+ * @example
40
+ * ```
41
+ * const result = filterByAllowedValues(['ReadOnlyMany', 'Invalid'],['ReadOnlyMany', 'ReadWriteOnce', 'ReadWriteMany'])
42
+ * console.log(result) // ['ReadOnlyMany']
43
+ * ```
44
+ */
45
+ private filterByAllowedValues;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<StorageCommonUtilService, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<StorageCommonUtilService>;
48
+ }
@@ -0,0 +1,130 @@
1
+ import { DialogService } from '@alauda/ui';
2
+ import { K8sApiService, PersistentVolumeClaim, Workspace, StringMap, CacheStore, AcpCommonApiService, Pod } from '@alauda-fe/common';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import { Observable } from 'rxjs';
5
+ import { DeletePvcDialogComponent } from '../components/pvc-delete-dialog/component';
6
+ import { StorageCommonUtilService } from '../services/common-util.service';
7
+ import { StorageclassFeature, StorageProvisioner } from '../types/commons';
8
+ import { StorageClass, VolumeSnapshotClass, VolumeSnapshot } from '../types/k8s';
9
+ import * as i0 from "@angular/core";
10
+ export declare const PVC_SNAPSHOT_FEATURE_GATE = "volume-snapshot";
11
+ export declare function pvcUpdateEnabled(resource: PersistentVolumeClaim): boolean;
12
+ export declare function getPvcDeletingDisabledState(pvc: PersistentVolumeClaim): {
13
+ tooltip: string;
14
+ disabled: boolean;
15
+ };
16
+ export declare function getPvcRebuildingDisabledState(pvc: PersistentVolumeClaim): {
17
+ tooltip: string;
18
+ disabled: boolean;
19
+ };
20
+ export declare const STORAGECLASS_FEATURE_FEATURE_GATE_MAP: Partial<Record<StorageclassFeature, Partial<Record<StorageProvisioner, string>>>>;
21
+ export declare enum PVCExpandDisabledReason {
22
+ PVC_STATUS_FORBID = "expand_pvc_status_forbid",
23
+ WITHOUT_STORAGE_CLASS = "expand_without_storage_class",
24
+ STORAGE_CLASS_FORBID = "expand_storage_class_forbid",
25
+ STORAGE_CLASS_NOTFOUND = "pvc_storage_class_not_found",
26
+ PVC_REBUILDING = "pvc_rebuilding",
27
+ PVC_DELETING = "pvc_deleting",
28
+ TOPOLVM_PVC_EXISTED_SNAPSHOT = "pvc_existed_snapshot"
29
+ }
30
+ export declare enum PVCSnapshotDisabledReason {
31
+ PVC_STATUS_FORBID = "snapshot_pvc_status_forbid",
32
+ WITHOUT_STORAGE_CLASS = "snapshot_without_storage_class",
33
+ STORAGE_CLASS_FORBID = "snapshot_storage_class_forbid",
34
+ SNAPSHOT_PLUGIN_NOT_INSTALLED = "snapshot_plugin_not_installed",
35
+ STORAGE_CLASS_NOTFOUND = "pvc_storage_class_not_found",
36
+ SNAPSHOT_UNSUPPORTED = "snapshot_unsupported",
37
+ PVC_REBUILDING = "pvc_rebuilding",
38
+ PVC_DELETING = "pvc_deleting",
39
+ PVC_EXPANDING = "pvc_expanding"
40
+ }
41
+ export type PVCActionStateFn = (pvc: PersistentVolumeClaim, mapper?: PVCActionTooltipMapper) => PVCActionState;
42
+ export interface PVCActionState {
43
+ disabled: boolean;
44
+ reason?: PVCExpandDisabledReason | PVCSnapshotDisabledReason;
45
+ tooltip?: string;
46
+ }
47
+ export type PVCActionTooltipMapper = (reason: PVCExpandDisabledReason | PVCSnapshotDisabledReason) => string;
48
+ export declare function defaultPVCExpandTooltipMapper(reason: PVCExpandDisabledReason): "" | "pvc_deleting_can_not_operate" | "pvc_rebuilding_can_not_operate" | "pvc_storage_class_not_found" | "pvc_status_forbid_expansion" | "pvc_static_forbid_expansion" | "pvc_storageclass_forbid_expansion" | "pvc_existed_snapshot_forbid_expansion";
49
+ export declare function defaultPVCSnapshotTooltipMapper(reason: PVCSnapshotDisabledReason): "" | "pvc_deleting_can_not_operate" | "pvc_storage_class_not_found" | "pvc_status_forbid_snapshot" | "unsupported_volume_snapshot" | "snapshot_disabled_tip" | "snapshot_plugin_disabled_tip" | "pvc_expansion_forbid_snapshot";
50
+ export declare class PVCUtilService {
51
+ private readonly dialog;
52
+ private readonly k8sApi;
53
+ private readonly acpApi;
54
+ private readonly storageCommonUtil;
55
+ private readonly http;
56
+ constructor(dialog: DialogService, k8sApi: K8sApiService, acpApi: AcpCommonApiService, storageCommonUtil: StorageCommonUtilService, http: HttpClient);
57
+ getRelatedPods(cluster: string, namespace: string, pvcName: string): Observable<Pod[]>;
58
+ storageClassListCache: CacheStore<Readonly<{
59
+ project: string;
60
+ cluster: string;
61
+ namespace: string;
62
+ }>, StorageClass[]>;
63
+ volumeSnapshotListCatch: CacheStore<Readonly<{
64
+ project: string;
65
+ cluster: string;
66
+ namespace: string;
67
+ }>, VolumeSnapshot[]>;
68
+ volumeSnapshotClassListCache: CacheStore<Readonly<{
69
+ project: string;
70
+ cluster: string;
71
+ namespace: string;
72
+ }>, VolumeSnapshotClass[]>;
73
+ snapshotPluginCache: CacheStore<Readonly<{
74
+ project: string;
75
+ cluster: string;
76
+ namespace: string;
77
+ }>, boolean>;
78
+ getSource$(pod: Pod, cluster: string, namespace: string): Observable<{
79
+ name: string;
80
+ kind: string;
81
+ }>;
82
+ private getSourceInfo$;
83
+ private sameOwnerReference;
84
+ delete(pvc: PersistentVolumeClaim, cluster: string, namespace: string): import("@alauda/ui").DialogRef<DeletePvcDialogComponent, any>;
85
+ rebuild(pvc: PersistentVolumeClaim, cluster: string, namespace: string): void;
86
+ getVolumeSnapshotEnabled$({ namespace, cluster }: Workspace): Observable<boolean>;
87
+ private getStorageClassList$;
88
+ private getVolumeSnapshotList$;
89
+ private getVolumeSnapshotClassList$;
90
+ getPvcExpandStateFn$(workspace: Workspace): Observable<PVCActionStateFn>;
91
+ getPvcSnapshotStateFn$(workspace: Workspace): Observable<PVCActionStateFn>;
92
+ getPvcExpandState({ pvc, scList, vsList, mapper, }: {
93
+ pvc: PersistentVolumeClaim;
94
+ scList: StorageClass[];
95
+ vsList: VolumeSnapshot[];
96
+ mapper?: PVCActionTooltipMapper;
97
+ }): {
98
+ disabled: boolean;
99
+ reason: PVCExpandDisabledReason;
100
+ tooltip: string;
101
+ };
102
+ private getPvcExpandDisabledReason;
103
+ getPvcSnapshotState({ pvc, scList, vscList, pluginEnabled, storageDescriptionList, mapper, }: {
104
+ pvc: PersistentVolumeClaim;
105
+ scList: StorageClass[];
106
+ vscList: VolumeSnapshotClass[];
107
+ pluginEnabled: boolean;
108
+ storageDescriptionList: StringMap[];
109
+ mapper?: PVCActionTooltipMapper;
110
+ }): {
111
+ disabled: boolean;
112
+ reason: PVCSnapshotDisabledReason;
113
+ tooltip: string;
114
+ };
115
+ getPvcUpdateDisabledState(pvc: PersistentVolumeClaim): {
116
+ disabled: boolean;
117
+ tooltip?: string;
118
+ };
119
+ getPvcRebuildDisabledState$(pvc: PersistentVolumeClaim, cluster: string, namespace: string): Observable<{
120
+ disabled: boolean;
121
+ tooltip?: string;
122
+ }>;
123
+ getPvcDeleteDisabledState(pvc: PersistentVolumeClaim): {
124
+ disabled: boolean;
125
+ tooltip?: string;
126
+ };
127
+ private getPvcSnapshotDisabledReason;
128
+ static ɵfac: i0.ɵɵFactoryDeclaration<PVCUtilService, never>;
129
+ static ɵprov: i0.ɵɵInjectableDeclaration<PVCUtilService>;
130
+ }
@@ -0,0 +1,85 @@
1
+ import { AccessMode, VolumeMode, ValueOf, Translation, GenericStatusColor, GenericStatusIcon } from '@alauda-fe/common';
2
+ import { StorageProvider } from './internal';
3
+ export declare enum StorageProvisioner {
4
+ CEPH_FS_INTERNAL = "rook-ceph.cephfs.csi.ceph.com",
5
+ CEPH_FS_RBD = "rook-ceph.rbd.csi.ceph.com",
6
+ CEPH_OBJECT = "rook-ceph.ceph.rook.io/bucket",
7
+ CEPH_COSI = "ceph.objectstorage.k8s.io",
8
+ CEPH_FS = "ceph.com/cephfs",
9
+ NFS = "cpaas.io/nfs-client",
10
+ TOPOLVM = "topolvm.cybozu.com",
11
+ HUAWEI_CSI = "csi.huawei.com",
12
+ NFS_CSI = "nfs.csi.k8s.io",
13
+ CSTOR_CSI = "cstor.csi.openebs.io",
14
+ MINIO = "minio.objectstorage.k8s.io"
15
+ }
16
+ export declare const StorageType: {
17
+ readonly FILE_STORAGE: "file_storage";
18
+ readonly OBJECT_STORAGE: "object_storage";
19
+ readonly BLOCK_STORAGE: "block_storage";
20
+ };
21
+ export type StorageType = ValueOf<typeof StorageType>;
22
+ export declare enum StorageclassFeature {
23
+ SNAPSHOT = "snapshot",
24
+ EXPANSION = "expansion"
25
+ }
26
+ export interface StorageOption {
27
+ provisioner: StorageProvisioner;
28
+ gate?: string;
29
+ clusterGate?: string;
30
+ module?: string;
31
+ provider: StorageProvider;
32
+ type?: StorageType;
33
+ display?: Translation;
34
+ accessModes: AccessMode[];
35
+ /** features字段中有StorageclassFeature.SNAPSHOT才有这个 */
36
+ snapshotAccessModes?: AccessMode[];
37
+ features: StorageclassFeature[];
38
+ volumeModes: VolumeMode[];
39
+ supportTypes?: StorageType[];
40
+ disabled?: boolean;
41
+ }
42
+ export declare enum VolumeBindingMode {
43
+ Immediate = "Immediate",
44
+ WaitForFirstConsumer = "WaitForFirstConsumer"
45
+ }
46
+ export declare enum ReclaimPolicy {
47
+ Retain = "Retain",
48
+ Delete = "Delete"
49
+ }
50
+ export declare enum PvcStatusEnum {
51
+ processing = "processing",
52
+ bound = "bound",
53
+ invalid = "invalid",
54
+ waiting = "waiting_to_bind_after_mounting"
55
+ }
56
+ export declare const PvcStatusColorMapper: {
57
+ processing: GenericStatusColor;
58
+ waiting_to_bind_after_mounting: GenericStatusColor;
59
+ bound: GenericStatusColor;
60
+ invalid: GenericStatusColor;
61
+ };
62
+ export declare const PvcStatusIconMapper: {
63
+ processing: GenericStatusIcon;
64
+ waiting_to_bind_after_mounting: GenericStatusIcon;
65
+ bound: string;
66
+ invalid: GenericStatusIcon;
67
+ };
68
+ export declare enum PvStatusEnum {
69
+ AVAILABLE = "available",
70
+ BOUND = "bound",
71
+ WAITING_RECYCLE = "waiting_recycle",
72
+ RECYCLE_FAILED = "recycle_failed"
73
+ }
74
+ export declare const PvStatusColorMapper: {
75
+ available: GenericStatusColor;
76
+ bound: GenericStatusColor;
77
+ waiting_recycle: GenericStatusColor;
78
+ recycle_failed: GenericStatusColor;
79
+ };
80
+ export declare const PvStatusIconMapper: {
81
+ available: GenericStatusIcon;
82
+ bound: string;
83
+ waiting_recycle: string;
84
+ recycle_failed: GenericStatusIcon;
85
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum StorageProvider {
2
+ PLATFORM = "platform",
3
+ THIRD_PARTY = "third_party"
4
+ }
@@ -0,0 +1,105 @@
1
+ import { AccessMode, KubernetesResource, StringMap } from '@alauda-fe/common';
2
+ import { ReclaimPolicy, StorageProvisioner, VolumeBindingMode } from './commons';
3
+ export interface VolumeSnapshotClass extends KubernetesResource {
4
+ driver: string;
5
+ parameters?: StringMap;
6
+ deletionPolicy?: string;
7
+ }
8
+ export interface VolumeSnapshot extends KubernetesResource {
9
+ spec: VolumeSnapshotSpec;
10
+ status?: {
11
+ boundVolumeSnapshotContentName?: string;
12
+ readyToUse?: boolean;
13
+ error?: string;
14
+ restoreSize?: string;
15
+ };
16
+ }
17
+ export interface VolumeSnapshotSpec {
18
+ volumeSnapshotClassName: string;
19
+ source?: {
20
+ persistentVolumeClaimName?: string;
21
+ };
22
+ }
23
+ export interface StorageClass extends KubernetesResource {
24
+ apiVersion: 'storage.k8s.io/v1';
25
+ kind: 'StorageClass';
26
+ mountOptions?: string[];
27
+ parameters?: StringMap;
28
+ provisioner?: StorageProvisioner;
29
+ reclaimPolicy?: ReclaimPolicy;
30
+ volumeBindingMode?: VolumeBindingMode;
31
+ allowVolumeExpansion?: boolean;
32
+ }
33
+ export interface BucketClass extends KubernetesResource {
34
+ kind: 'BucketClass';
35
+ driverName: StorageProvisioner;
36
+ deletionPolicy?: ReclaimPolicy;
37
+ isDefaultBucketClass?: boolean;
38
+ parameters?: StringMap;
39
+ protocol?: {
40
+ s3: {
41
+ region: string;
42
+ signatureVersion: string;
43
+ };
44
+ };
45
+ }
46
+ export type CommonStorageClass = StorageClass | BucketClass;
47
+ export type CommonStorageClassKind = CommonStorageClass extends {
48
+ kind: infer K;
49
+ } ? K : never;
50
+ export interface CephFSPersistentVolumeSource {
51
+ monitors: string[];
52
+ path?: string;
53
+ secretRef: SecretReference;
54
+ user: string;
55
+ }
56
+ export interface SecretReference {
57
+ name: string;
58
+ namespace: string;
59
+ }
60
+ export interface PersistentVolumeSpec extends PersistentVolumeSpecMeta {
61
+ accessModes: [AccessMode];
62
+ storageClassName?: string;
63
+ }
64
+ export interface PersistentVolume extends KubernetesResource {
65
+ apiVersion: string;
66
+ kind: string;
67
+ spec: PersistentVolumeSpec;
68
+ status?: {
69
+ phase: string;
70
+ };
71
+ }
72
+ export interface PersistentVolumeSpecMeta {
73
+ capacity: {
74
+ storage: string;
75
+ };
76
+ claimRef?: {
77
+ apiVersion: string;
78
+ kind: 'PersistentVolumeClaim';
79
+ name: string;
80
+ namespace: string;
81
+ uid: string;
82
+ };
83
+ persistentVolumeReclaimPolicy: 'Retain' | 'Delete';
84
+ hostPath?: {
85
+ path: string;
86
+ };
87
+ nfs?: {
88
+ server: string;
89
+ path: string;
90
+ };
91
+ cephfs?: CephFSPersistentVolumeSource;
92
+ mountOptions?: string[];
93
+ csi?: {
94
+ driver?: string;
95
+ readOnly?: boolean;
96
+ /** 该字段由UI生成, 需保证集群唯一, 可采用uuid */
97
+ volumeHandle?: string;
98
+ volumeAttributes: {
99
+ /** nfs 服务端地址 */
100
+ server: string;
101
+ /** nfs 服务端fs目录 */
102
+ share: string;
103
+ };
104
+ };
105
+ }