@alauda-fe/network 1.0.0-beta.0
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.
- package/esm2022/alauda-fe-network.mjs +5 -0
- package/esm2022/index.mjs +19 -0
- package/esm2022/lib/components/certificate-status/component.mjs +37 -0
- package/esm2022/lib/components/fixed-ip/component.mjs +503 -0
- package/esm2022/lib/components/loadbalancer-spec-form/component.mjs +251 -0
- package/esm2022/lib/components/service-annotations-form/annotations.component.mjs +681 -0
- package/esm2022/lib/components/service-annotations-form-item/annotations.component.mjs +106 -0
- package/esm2022/lib/components/service-form/component.mjs +307 -0
- package/esm2022/lib/components/service-form/fieldset/component.mjs +407 -0
- package/esm2022/lib/directives/subnet-validator.directive.mjs +111 -0
- package/esm2022/lib/services/alb-api.service.mjs +48 -0
- package/esm2022/lib/services/certificate-api.service.mjs +111 -0
- package/esm2022/lib/services/network-util.service.mjs +116 -0
- package/esm2022/lib/types/alb-exports.mjs +14 -0
- package/esm2022/lib/types/k8s-exports.mjs +13 -0
- package/esm2022/lib/types/resource-definition.mjs +16 -0
- package/esm2022/lib/utils/alb-exports.mjs +108 -0
- package/esm2022/lib/utils/alb-internals.mjs +2 -0
- package/esm2022/lib/utils/cidr-exports.mjs +359 -0
- package/esm2022/lib/utils/cluster-exports.mjs +18 -0
- package/esm2022/lib/utils/service-exports.mjs +58 -0
- package/esm2022/lib/utils/service-internals.mjs +7 -0
- package/esm2022/lib/utils/subnet-exports.mjs +18 -0
- package/index.d.ts +18 -0
- package/lib/components/certificate-status/component.d.ts +17 -0
- package/lib/components/fixed-ip/component.d.ts +67 -0
- package/lib/components/loadbalancer-spec-form/component.d.ts +34 -0
- package/lib/components/service-annotations-form/annotations.component.d.ts +74 -0
- package/lib/components/service-annotations-form-item/annotations.component.d.ts +14 -0
- package/lib/components/service-form/component.d.ts +56 -0
- package/lib/components/service-form/fieldset/component.d.ts +46 -0
- package/lib/directives/subnet-validator.directive.d.ts +34 -0
- package/lib/services/alb-api.service.d.ts +16 -0
- package/lib/services/certificate-api.service.d.ts +38 -0
- package/lib/services/network-util.service.d.ts +21 -0
- package/lib/types/alb-exports.d.ts +29 -0
- package/lib/types/k8s-exports.d.ts +130 -0
- package/lib/types/resource-definition.d.ts +25 -0
- package/lib/utils/alb-exports.d.ts +16 -0
- package/lib/utils/alb-internals.d.ts +10 -0
- package/lib/utils/cidr-exports.d.ts +85 -0
- package/lib/utils/cluster-exports.d.ts +14 -0
- package/lib/utils/service-exports.d.ts +18 -0
- package/lib/utils/service-internals.d.ts +2 -0
- package/lib/utils/subnet-exports.d.ts +20 -0
- package/package.json +31 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseResourceFormGroupComponent } from 'ng-resource-form-util';
|
|
2
|
+
import { AlbResourceLimitModel, SpecModel } from '../../types/alb-exports';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class LoadBalancerSpecFormComponent extends BaseResourceFormGroupComponent<AlbResourceLimitModel> {
|
|
5
|
+
SpecModel: typeof SpecModel;
|
|
6
|
+
SPEC_MODEL_TIPS: {
|
|
7
|
+
model: SpecModel;
|
|
8
|
+
tip: string;
|
|
9
|
+
}[];
|
|
10
|
+
POSITIVE_INT_PATTERN: {
|
|
11
|
+
pattern: RegExp;
|
|
12
|
+
tip: string;
|
|
13
|
+
};
|
|
14
|
+
createForm(): import("@angular/forms").FormGroup<{
|
|
15
|
+
specModel: import("@angular/forms").FormControl<SpecModel>;
|
|
16
|
+
resourceLimit: import("@angular/forms").FormGroup<{
|
|
17
|
+
cpu: import("@angular/forms").FormGroup<{
|
|
18
|
+
value: import("@angular/forms").FormControl<number>;
|
|
19
|
+
unit: import("@angular/forms").FormControl<"core" | "m">;
|
|
20
|
+
}>;
|
|
21
|
+
memory: import("@angular/forms").FormGroup<{
|
|
22
|
+
value: import("@angular/forms").FormControl<number>;
|
|
23
|
+
unit: import("@angular/forms").FormControl<"Gi" | "Mi">;
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
getDefaultFormModel(): {
|
|
28
|
+
specModel: SpecModel;
|
|
29
|
+
resourceLimit: import("../../utils/alb-internals").ResourceLimit;
|
|
30
|
+
};
|
|
31
|
+
onSpecModelChange(specModel: SpecModel): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoadBalancerSpecFormComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LoadBalancerSpecFormComponent, "acl-alb-spec-form", never, {}, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BaseStringMapFormComponent, KeyValueTuple, Locale, StringMap, TranslateKey } from '@alauda-fe/common';
|
|
2
|
+
import { Injector } from '@angular/core';
|
|
3
|
+
import { FormArray, FormControl } from '@angular/forms';
|
|
4
|
+
import { ClusterType } from '../../utils/cluster-exports';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
declare enum PRODUCT_BASE_HREF_MAP {
|
|
7
|
+
devops = "/console-devops/",
|
|
8
|
+
acp = "/console-acp/",
|
|
9
|
+
asm = "/console-asm/",
|
|
10
|
+
dataservices = "/console-dataservices/",
|
|
11
|
+
cec = "/console-cec/",
|
|
12
|
+
platform = "/console-platform/"
|
|
13
|
+
}
|
|
14
|
+
export interface AnnotationConfigOption {
|
|
15
|
+
key: string;
|
|
16
|
+
tip: TranslateKey<Locale>;
|
|
17
|
+
doc?: {
|
|
18
|
+
tip: TranslateKey<Locale>;
|
|
19
|
+
tipPrefix?: TranslateKey<Locale>;
|
|
20
|
+
path?: string;
|
|
21
|
+
rawUrl?: string;
|
|
22
|
+
product?: keyof typeof PRODUCT_BASE_HREF_MAP;
|
|
23
|
+
};
|
|
24
|
+
value?: {
|
|
25
|
+
example: string;
|
|
26
|
+
tip: TranslateKey<Locale>;
|
|
27
|
+
docLink: string;
|
|
28
|
+
};
|
|
29
|
+
values?: Array<{
|
|
30
|
+
value: string;
|
|
31
|
+
tip?: TranslateKey<Locale>;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export declare const KNOWN_ANNOTATIONS: Partial<Record<ClusterType, {
|
|
35
|
+
label: string;
|
|
36
|
+
docLink: string;
|
|
37
|
+
options: AnnotationConfigOption[];
|
|
38
|
+
}>>;
|
|
39
|
+
export declare class ServiceAnnotationsFormComponent extends BaseStringMapFormComponent {
|
|
40
|
+
private readonly baseDomain;
|
|
41
|
+
isUpdate: boolean;
|
|
42
|
+
clusterType: ClusterType;
|
|
43
|
+
resourceName: string;
|
|
44
|
+
private readonly translate;
|
|
45
|
+
protected readonly baseHref: string;
|
|
46
|
+
readonly readonlyPartialKeys: string[];
|
|
47
|
+
annotationsErrorsMapper: import("rxjs").Observable<{
|
|
48
|
+
key: {
|
|
49
|
+
namePattern: string;
|
|
50
|
+
prefixPattern: string;
|
|
51
|
+
nameTooLong: string;
|
|
52
|
+
prefixTooLong: string;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
KNOWN_ANNOTATIONS: Partial<Record<ClusterType, {
|
|
56
|
+
label: string;
|
|
57
|
+
docLink: string;
|
|
58
|
+
options: AnnotationConfigOption[];
|
|
59
|
+
}>>;
|
|
60
|
+
constructor(injector: Injector, baseDomain: string);
|
|
61
|
+
filterOptions(options: AnnotationConfigOption[] | undefined, index: number): AnnotationConfigOption[];
|
|
62
|
+
getConfigOption(options: AnnotationConfigOption[] | undefined, key: string): AnnotationConfigOption;
|
|
63
|
+
isReadonly(key: string): boolean;
|
|
64
|
+
getDefaultFormModel(): KeyValueTuple[];
|
|
65
|
+
adaptResourceModel(resource: StringMap): [string, string][];
|
|
66
|
+
getKeyValidators(): typeof import("@alauda-fe/common").k8sResourceLabelKeyValidator;
|
|
67
|
+
isLabelReadonly(control: FormArray<FormControl<string>>): boolean;
|
|
68
|
+
getActiveConfigOption(options: AnnotationConfigOption[] | undefined, key: string): AnnotationConfigOption;
|
|
69
|
+
onKeySelected(control: FormArray<FormControl<string>>): void;
|
|
70
|
+
showDocLink(baseHref: string, product?: keyof typeof PRODUCT_BASE_HREF_MAP): boolean;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ServiceAnnotationsFormComponent, never>;
|
|
72
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ServiceAnnotationsFormComponent, "acl-service-annotations-form", never, { "isUpdate": { "alias": "isUpdate"; "required": true; }; "clusterType": { "alias": "clusterType"; "required": true; }; "resourceName": { "alias": "resourceName"; "required": true; }; }, {}, never, ["*"], true, never>;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StringMap } from '@alauda-fe/common';
|
|
2
|
+
import { BaseResourceFormComponent } from 'ng-resource-form-util';
|
|
3
|
+
import { ClusterType } from '../../utils/cluster-exports';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ServiceAnnotationsFormItemComponent extends BaseResourceFormComponent<StringMap> {
|
|
6
|
+
isUpdate: boolean;
|
|
7
|
+
clusterType: ClusterType;
|
|
8
|
+
inService: boolean;
|
|
9
|
+
get resourceName(): "annotation" | "service_annotations";
|
|
10
|
+
isPublicCloud: (clusterType?: string) => boolean;
|
|
11
|
+
createForm(): import("@angular/forms").FormControl<{}>;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ServiceAnnotationsFormItemComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ServiceAnnotationsFormItemComponent, "acl-service-annotations-form-item", never, { "isUpdate": { "alias": "isUpdate"; "required": true; }; "clusterType": { "alias": "clusterType"; "required": true; }; "inService": { "alias": "inService"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ContainerPort, FeatureGateService, K8sUtilService, Service } from '@alauda-fe/common';
|
|
2
|
+
import { AfterViewInit, Injector } from '@angular/core';
|
|
3
|
+
import { BaseResourceFormGroupComponent } from 'ng-resource-form-util';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
interface ServiceFormModel extends Service {
|
|
7
|
+
virtualIp?: boolean;
|
|
8
|
+
sessionPersistence?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class K8sServiceFormComponent extends BaseResourceFormGroupComponent<Service, ServiceFormModel> implements AfterViewInit {
|
|
11
|
+
private readonly k8sUtil;
|
|
12
|
+
private readonly featureGate;
|
|
13
|
+
cluster: string;
|
|
14
|
+
cluster$: Observable<string>;
|
|
15
|
+
isUpdate: boolean;
|
|
16
|
+
isUpdate$: Observable<boolean>;
|
|
17
|
+
containerPortSuggestions: ContainerPort[];
|
|
18
|
+
targetComponent: 'workload' | 'vm' | 'label-selectors';
|
|
19
|
+
K8S_RESOURCE_NAME_START_WITH_CHARS_ONLY: {
|
|
20
|
+
pattern: RegExp;
|
|
21
|
+
tip: string;
|
|
22
|
+
};
|
|
23
|
+
DOMAIN_PATTERN: {
|
|
24
|
+
pattern: RegExp;
|
|
25
|
+
placeholder: string;
|
|
26
|
+
tip: string;
|
|
27
|
+
};
|
|
28
|
+
displayNameKey: string;
|
|
29
|
+
isLbEnabled$: Observable<boolean>;
|
|
30
|
+
types$: Observable<readonly ["ClusterIP", "NodePort", "LoadBalancer", "ExternalName"] | ("ClusterIP" | "NodePort" | "LoadBalancer" | "ExternalName")[]>;
|
|
31
|
+
constructor(injector: Injector, k8sUtil: K8sUtilService, featureGate: FeatureGateService);
|
|
32
|
+
ngAfterViewInit(): void;
|
|
33
|
+
getDefaultFormModel(): ServiceFormModel;
|
|
34
|
+
createForm(): import("@angular/forms").FormGroup<{
|
|
35
|
+
virtualIp: import("@angular/forms").FormControl<boolean>;
|
|
36
|
+
sessionPersistence: import("@angular/forms").FormControl<boolean>;
|
|
37
|
+
metadata: import("@angular/forms").FormGroup<{
|
|
38
|
+
name: import("@angular/forms").FormControl<string>;
|
|
39
|
+
labels: import("@angular/forms").FormControl<{}>;
|
|
40
|
+
annotations: import("@angular/forms").FormGroup<{
|
|
41
|
+
[x: string]: import("@angular/forms").FormControl<string>;
|
|
42
|
+
}>;
|
|
43
|
+
}>;
|
|
44
|
+
spec: import("@angular/forms").FormGroup<{
|
|
45
|
+
type: import("@angular/forms").FormControl<string>;
|
|
46
|
+
ports: import("@angular/forms").FormControl<unknown>;
|
|
47
|
+
externalName: import("@angular/forms").FormControl<string>;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
adaptFormModel({ virtualIp, sessionPersistence, ...resource }: ServiceFormModel): Service;
|
|
51
|
+
adaptResourceModel(resource: Service): ServiceFormModel;
|
|
52
|
+
onVirtualIpChange(virtualIp: boolean): void;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<K8sServiceFormComponent, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<K8sServiceFormComponent, "acl-k8s-service-form", never, { "cluster": { "alias": "cluster"; "required": true; }; "isUpdate": { "alias": "isUpdate"; "required": false; }; "containerPortSuggestions": { "alias": "containerPortSuggestions"; "required": true; }; "targetComponent": { "alias": "targetComponent"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ContainerPort, ServicePort, ServicePortProtocol, ServiceType, ValidateRowDuplicateService } from '@alauda-fe/common';
|
|
2
|
+
import { Injector, OnInit } from '@angular/core';
|
|
3
|
+
import { AbstractControl, ControlContainer, FormGroup } from '@angular/forms';
|
|
4
|
+
import { BaseResourceFormArrayComponent } from 'ng-resource-form-util';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class ServicePortsFieldsetComponent extends BaseResourceFormArrayComponent<ServicePort> implements OnInit {
|
|
7
|
+
injector: Injector;
|
|
8
|
+
readonly controlContainer: ControlContainer;
|
|
9
|
+
private readonly rowDupService;
|
|
10
|
+
_required: boolean;
|
|
11
|
+
get required(): boolean | '';
|
|
12
|
+
set required(required: boolean | '');
|
|
13
|
+
serviceType: ServiceType;
|
|
14
|
+
containerPortSuggestions: ContainerPort[];
|
|
15
|
+
existedPorts: ServicePort[];
|
|
16
|
+
targetComponent: 'workload' | 'vm' | 'label-selectors';
|
|
17
|
+
constructor(injector: Injector, controlContainer: ControlContainer, rowDupService: ValidateRowDuplicateService);
|
|
18
|
+
servicePortProtocols: readonly ["TCP", "UDP", "HTTP", "HTTPS", "HTTP2", "gRPC"];
|
|
19
|
+
namePattern: {
|
|
20
|
+
pattern: RegExp;
|
|
21
|
+
tip: string;
|
|
22
|
+
};
|
|
23
|
+
ngOnInit(): void;
|
|
24
|
+
getOnFormArrayResizeFn(): () => FormGroup<{
|
|
25
|
+
name: import("@angular/forms").FormControl<string>;
|
|
26
|
+
protocol: import("@angular/forms").FormControl<"TCP">;
|
|
27
|
+
appProtocol: import("@angular/forms").FormControl<string>;
|
|
28
|
+
port: import("@angular/forms").FormControl<string>;
|
|
29
|
+
targetPort: import("@angular/forms").FormControl<string>;
|
|
30
|
+
}>;
|
|
31
|
+
getResourceMergeStrategy(): boolean;
|
|
32
|
+
private createNewControl;
|
|
33
|
+
validateServiceType(_ctrl?: AbstractControl): {
|
|
34
|
+
protocol: boolean;
|
|
35
|
+
};
|
|
36
|
+
adaptResourceModel(ports: ServicePort[]): ServicePort[];
|
|
37
|
+
adaptFormModel(ports: ServicePort[]): ServicePort[];
|
|
38
|
+
updateAppProtocol(group: FormGroup): void;
|
|
39
|
+
updateValueAndValidity(): void;
|
|
40
|
+
getContainerPortSuggestions(containerPortSuggestions: ContainerPort[], appProtocol: Lowercase<ServicePortProtocol>): ContainerPort[];
|
|
41
|
+
updateContainerPort(control: AbstractControl, value: string): void;
|
|
42
|
+
autoCompleteContainerPort(control: AbstractControl, value: number): void;
|
|
43
|
+
getContainerPortTranslateKey(targetComponent: 'vm' | 'workload' | 'label-selectors'): "vm_port" | "container_port";
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ServicePortsFieldsetComponent, [null, { optional: true; }, null]>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ServicePortsFieldsetComponent, "acl-service-ports-fieldset", never, { "required": { "alias": "required"; "required": false; }; "serviceType": { "alias": "serviceType"; "required": false; }; "containerPortSuggestions": { "alias": "containerPortSuggestions"; "required": false; }; "existedPorts": { "alias": "existedPorts"; "required": false; }; "targetComponent": { "alias": "targetComponent"; "required": false; }; }, {}, never, never, true, never>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AbstractControl, Validator } from '@angular/forms';
|
|
2
|
+
import { IPMode } from '../utils/cidr-exports';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class CidrIpDirective implements Validator {
|
|
5
|
+
info?: {
|
|
6
|
+
ipMode: IPMode;
|
|
7
|
+
segment: string;
|
|
8
|
+
};
|
|
9
|
+
control: AbstractControl;
|
|
10
|
+
validate(control: AbstractControl): {
|
|
11
|
+
pattern: boolean;
|
|
12
|
+
ipNotInCidr?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
ipNotInCidr: string;
|
|
15
|
+
pattern?: undefined;
|
|
16
|
+
};
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CidrIpDirective, never>;
|
|
18
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CidrIpDirective, "[rcCidrIp]", never, { "info": { "alias": "rcCidrIp"; "required": false; }; }, {}, never, never, true, never>;
|
|
19
|
+
}
|
|
20
|
+
export declare class CidrScaleSubnetDirective implements Validator {
|
|
21
|
+
info?: {
|
|
22
|
+
ipMode: IPMode;
|
|
23
|
+
segment: string;
|
|
24
|
+
};
|
|
25
|
+
validate(control: AbstractControl): {
|
|
26
|
+
pattern: boolean;
|
|
27
|
+
cidrContain?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
cidrContain: string;
|
|
30
|
+
pattern?: undefined;
|
|
31
|
+
};
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CidrScaleSubnetDirective, never>;
|
|
33
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CidrScaleSubnetDirective, "[rcCidrScaleSubnet]", never, { "info": { "alias": "rcCidrScaleSubnet"; "required": false; }; }, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HelmRequest, K8sSharedUtilService, KubernetesResourceList } from '@alauda-fe/common';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { ALB2, LoadBalancer } from '../types/k8s-exports';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class AlbApiService {
|
|
6
|
+
private readonly http;
|
|
7
|
+
private readonly k8sUtil;
|
|
8
|
+
constructor(http: HttpClient, k8sUtil: K8sSharedUtilService);
|
|
9
|
+
getAlbListByProject({ project, cluster }: {
|
|
10
|
+
project: string;
|
|
11
|
+
cluster: string;
|
|
12
|
+
}, queryParams?: Record<string, string>): import("rxjs").Observable<KubernetesResourceList<LoadBalancer>>;
|
|
13
|
+
v1ToV2Beta1(alb: LoadBalancer, hr?: HelmRequest): ALB2;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AlbApiService, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AlbApiService>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FeatureGateService, K8sApiService, KubernetesResourceList, Certificate, ResourceType, Secret, K8sUtilService } from '@alauda-fe/common';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class CertificateApiService {
|
|
6
|
+
private readonly http;
|
|
7
|
+
private readonly k8sApi;
|
|
8
|
+
private readonly k8sUtil;
|
|
9
|
+
private readonly featureGate;
|
|
10
|
+
private readonly globalNamespace;
|
|
11
|
+
private globalClusterInfo$;
|
|
12
|
+
isGlobalSecretEnabled$: Observable<boolean>;
|
|
13
|
+
constructor(http: HttpClient, k8sApi: K8sApiService<ResourceType>, k8sUtil: K8sUtilService, featureGate: FeatureGateService, globalNamespace: string);
|
|
14
|
+
getCertificatesAndSecrets(params$: Observable<{
|
|
15
|
+
cluster?: string;
|
|
16
|
+
namespace?: string;
|
|
17
|
+
project?: string;
|
|
18
|
+
}>, extraGlobalSecretEnabled$?: Observable<boolean>): Observable<Secret<import("@alauda-fe/common").StringMap>[]>;
|
|
19
|
+
getCertificates(names: string[], { cluster, namespace, }?: {
|
|
20
|
+
cluster?: string;
|
|
21
|
+
namespace?: string;
|
|
22
|
+
}): Observable<Certificate[]>;
|
|
23
|
+
getCertificate(name: string, params?: {
|
|
24
|
+
cluster: string;
|
|
25
|
+
namespace: string;
|
|
26
|
+
}): Observable<Certificate>;
|
|
27
|
+
normalizeCertificates(original: Secret, params?: {
|
|
28
|
+
cluster: string;
|
|
29
|
+
namespace: string;
|
|
30
|
+
}): Observable<Secret>;
|
|
31
|
+
normalizeCertificates(original: KubernetesResourceList<Secret>, params?: {
|
|
32
|
+
cluster: string;
|
|
33
|
+
namespace: string;
|
|
34
|
+
}): Observable<KubernetesResourceList<Secret>>;
|
|
35
|
+
private getGlobalClusterInfo;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CertificateApiService, never>;
|
|
37
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CertificateApiService>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { K8sApiService, K8sUtilService, Namespace } from '@alauda-fe/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Subnet } from '../types/k8s-exports';
|
|
4
|
+
import { IPMode, NetworkMode } from '../utils/cidr-exports';
|
|
5
|
+
import { ClusterNetworkType } from '../utils/subnet-exports';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class NetworkUtilService {
|
|
8
|
+
private readonly k8sApi;
|
|
9
|
+
private readonly k8sUtil;
|
|
10
|
+
constructor(k8sApi: K8sApiService, k8sUtil: K8sUtilService);
|
|
11
|
+
/**
|
|
12
|
+
* 集群网络类型,支持 kube-ovn,calico
|
|
13
|
+
* 若 kube-ovn,calico 同时存在,优先判定为 ovn
|
|
14
|
+
*/
|
|
15
|
+
getNetworkTypeByCluster$(cluster: string): Observable<ClusterNetworkType>;
|
|
16
|
+
getNetworkMode$(cluster: string): Observable<"v4" | "v6" | "dual">;
|
|
17
|
+
getCalicoCidrs(namespace: Namespace, subnets: Subnet[], networkMode: NetworkMode, enableFixIpV6ForDual?: boolean): string[];
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NetworkUtilService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NetworkUtilService>;
|
|
20
|
+
}
|
|
21
|
+
export declare function getCidrFromSubnetList(subnetNames: string[], subnets: Subnet[], ipMode: IPMode): string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ResourceLimit } from '../utils/alb-internals';
|
|
2
|
+
export declare enum AlbResourceType {
|
|
3
|
+
ALB = "ALB2",
|
|
4
|
+
FRONTEND = "Frontend",
|
|
5
|
+
RULE = "Rule"
|
|
6
|
+
}
|
|
7
|
+
export interface PortRangeItem {
|
|
8
|
+
port: string;
|
|
9
|
+
projects: string[];
|
|
10
|
+
usedPorts?: number[];
|
|
11
|
+
}
|
|
12
|
+
export interface PlainResourceLimit {
|
|
13
|
+
cpu?: string;
|
|
14
|
+
memory?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AlbResources {
|
|
17
|
+
limits?: PlainResourceLimit;
|
|
18
|
+
requests?: PlainResourceLimit;
|
|
19
|
+
}
|
|
20
|
+
export declare enum SpecModel {
|
|
21
|
+
SMALL = "small",
|
|
22
|
+
MEDIUM = "medium",
|
|
23
|
+
LARGE = "large",
|
|
24
|
+
CUSTOMIZE = "customize"
|
|
25
|
+
}
|
|
26
|
+
export interface AlbResourceLimitModel {
|
|
27
|
+
specModel: SpecModel;
|
|
28
|
+
resourceLimit: ResourceLimit;
|
|
29
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Condition, KubernetesResource, StringMap } from '@alauda-fe/common';
|
|
2
|
+
export declare enum EncapsulateProtocol {
|
|
3
|
+
IPIP = "IPIP",
|
|
4
|
+
VXLAN = "VXLAN",
|
|
5
|
+
NEVER = "NEVER"
|
|
6
|
+
}
|
|
7
|
+
export declare enum EncapsulateMode {
|
|
8
|
+
ALWAYS = "Always",
|
|
9
|
+
CROSS_SUBNET = "CrossSubnet",
|
|
10
|
+
NEVER = "Never"
|
|
11
|
+
}
|
|
12
|
+
export interface SubnetStatus {
|
|
13
|
+
usingIPs?: number;
|
|
14
|
+
availableIPs?: number;
|
|
15
|
+
v4usingIPs?: number;
|
|
16
|
+
v4availableIPs?: number;
|
|
17
|
+
v6usingIPs?: number;
|
|
18
|
+
v6availableIPs?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SubnetSpec {
|
|
21
|
+
default: boolean;
|
|
22
|
+
protocol: 'IPv4' | 'IPv6' | 'Dual';
|
|
23
|
+
namespaces?: string[];
|
|
24
|
+
cidrBlock: string;
|
|
25
|
+
natOutgoing?: boolean;
|
|
26
|
+
ipipMode?: EncapsulateMode;
|
|
27
|
+
vxlanMode?: EncapsulateMode;
|
|
28
|
+
blockSize?: number;
|
|
29
|
+
v4blockSize?: number;
|
|
30
|
+
v6blockSize?: number;
|
|
31
|
+
gateway: string;
|
|
32
|
+
excludeIps: string[];
|
|
33
|
+
gatewayType: string;
|
|
34
|
+
gatewayNode?: string;
|
|
35
|
+
private?: boolean;
|
|
36
|
+
allowSubnets?: string[];
|
|
37
|
+
enableEcmp?: boolean;
|
|
38
|
+
vlan?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Subnet extends KubernetesResource {
|
|
41
|
+
spec?: SubnetSpec;
|
|
42
|
+
status?: SubnetStatus;
|
|
43
|
+
}
|
|
44
|
+
export interface SubnetIpSpec {
|
|
45
|
+
podName: string;
|
|
46
|
+
namespace: string;
|
|
47
|
+
subnet: string;
|
|
48
|
+
nodeName: string;
|
|
49
|
+
ipAddress?: string;
|
|
50
|
+
macAddress: string;
|
|
51
|
+
}
|
|
52
|
+
export interface SubnetIp extends KubernetesResource {
|
|
53
|
+
spec?: SubnetIpSpec;
|
|
54
|
+
}
|
|
55
|
+
export interface LoadBalancer extends KubernetesResource {
|
|
56
|
+
kind: 'ALB2';
|
|
57
|
+
spec?: LoadBalancerSpec;
|
|
58
|
+
status?: LoadBalancerStatus;
|
|
59
|
+
}
|
|
60
|
+
export interface LoadBalancerStatus {
|
|
61
|
+
probeTime: string;
|
|
62
|
+
reason: string;
|
|
63
|
+
state: 'ready' | 'warning';
|
|
64
|
+
}
|
|
65
|
+
export interface LoadBalancerSpec {
|
|
66
|
+
address: string;
|
|
67
|
+
bind_address: string;
|
|
68
|
+
domains: string[];
|
|
69
|
+
iaas_id: string;
|
|
70
|
+
type: 'nginx';
|
|
71
|
+
}
|
|
72
|
+
export interface ALB2Status extends Condition {
|
|
73
|
+
detail?: {
|
|
74
|
+
address: {
|
|
75
|
+
host: string[];
|
|
76
|
+
ipv4: string[];
|
|
77
|
+
ipv6: string[];
|
|
78
|
+
msg?: string;
|
|
79
|
+
ok?: boolean;
|
|
80
|
+
};
|
|
81
|
+
alb?: StringMap;
|
|
82
|
+
version?: {
|
|
83
|
+
imagePatch: string;
|
|
84
|
+
version: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export interface ALB2Spec {
|
|
89
|
+
address?: string;
|
|
90
|
+
config: {
|
|
91
|
+
enableAlb?: boolean;
|
|
92
|
+
vip?: {
|
|
93
|
+
enableLbSvc: boolean;
|
|
94
|
+
lbSvcAnnotations?: StringMap;
|
|
95
|
+
};
|
|
96
|
+
displayName?: string;
|
|
97
|
+
networkMode: 'host' | 'container';
|
|
98
|
+
enablePortProject?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
Array<{
|
|
101
|
+
port: string;
|
|
102
|
+
projects: string[];
|
|
103
|
+
}>
|
|
104
|
+
*/
|
|
105
|
+
portProjects?: string;
|
|
106
|
+
nodeSelector?: StringMap;
|
|
107
|
+
projects?: string[];
|
|
108
|
+
replicas?: number;
|
|
109
|
+
resources?: {
|
|
110
|
+
limits?: {
|
|
111
|
+
cpu: string;
|
|
112
|
+
memory: string;
|
|
113
|
+
};
|
|
114
|
+
requests?: {
|
|
115
|
+
cpu: string;
|
|
116
|
+
memory: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
gateway?: {
|
|
120
|
+
mode: 'standalone' | 'share';
|
|
121
|
+
name: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
type: 'nginx';
|
|
125
|
+
}
|
|
126
|
+
export interface ALB2 extends KubernetesResource {
|
|
127
|
+
kind: 'ALB2';
|
|
128
|
+
spec: ALB2Spec;
|
|
129
|
+
status?: ALB2Status;
|
|
130
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const KUBE_OVN_GROUP = "kubeovn.io";
|
|
2
|
+
export declare const NetworkResourceDefinitions: {
|
|
3
|
+
readonly SUBNET_KUBE_OVN: {
|
|
4
|
+
readonly type: "subnets";
|
|
5
|
+
readonly apiGroup: "kubeovn.io";
|
|
6
|
+
};
|
|
7
|
+
readonly SUBNET_KUBE_OVN_IP: {
|
|
8
|
+
readonly type: "ips";
|
|
9
|
+
readonly apiGroup: "kubeovn.io";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const NETWORK_RESOURCE_DEFINITIONS: {
|
|
13
|
+
readonly SUBNET_KUBE_OVN: {
|
|
14
|
+
readonly type: "subnets";
|
|
15
|
+
readonly apiGroup: "kubeovn.io";
|
|
16
|
+
};
|
|
17
|
+
readonly SUBNET_KUBE_OVN_IP: {
|
|
18
|
+
readonly type: "ips";
|
|
19
|
+
readonly apiGroup: "kubeovn.io";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const NETWORK_RESOURCE_TYPES: {
|
|
23
|
+
readonly SUBNET_KUBE_OVN: "SUBNET_KUBE_OVN";
|
|
24
|
+
readonly SUBNET_KUBE_OVN_IP: "SUBNET_KUBE_OVN_IP";
|
|
25
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LooseValueOf } from '@alauda-fe/common';
|
|
2
|
+
import { PlainResourceLimit, SpecModel, AlbResourceLimitModel } from '../types/alb-exports';
|
|
3
|
+
import { ALB2 } from '../types/k8s-exports';
|
|
4
|
+
import { ResourceLimit } from './alb-internals';
|
|
5
|
+
export declare const formatResourceLimit: ({ value, unit, }: LooseValueOf<ResourceLimit>) => string;
|
|
6
|
+
export declare const parseResourceLimit: (plainResourceLimit?: PlainResourceLimit) => {
|
|
7
|
+
specModel: SpecModel;
|
|
8
|
+
resourceLimit: PlainResourceLimit;
|
|
9
|
+
};
|
|
10
|
+
export declare const RESOURCE_LIMIT_MAPPER: Partial<Record<SpecModel, ResourceLimit>>;
|
|
11
|
+
export declare function getResourceLimit(resource: ALB2): AlbResourceLimitModel;
|
|
12
|
+
export declare const METALLB = "metallb";
|
|
13
|
+
export declare const METALLB_NS: "metallb-system";
|
|
14
|
+
export declare function parseAddresses(alb2: ALB2): string[];
|
|
15
|
+
export declare function getAddressPriority(address: string): 0 | 1 | 2;
|
|
16
|
+
export declare function sortAddressesByPriority(addresses: string[]): string[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ValueOf } from '@alauda-fe/common';
|
|
2
|
+
import { Address4, Address6 } from 'ip-address';
|
|
3
|
+
interface SegmentModel {
|
|
4
|
+
ipV4Segment?: string;
|
|
5
|
+
ipV6Segment?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* note: we don't use enum here because ts do not support extends enum for now
|
|
9
|
+
* @link https://github.com/microsoft/TypeScript/issues/17592
|
|
10
|
+
*/
|
|
11
|
+
export declare const IPMode: {
|
|
12
|
+
readonly IPV4: "v4";
|
|
13
|
+
readonly IPV6: "v6";
|
|
14
|
+
};
|
|
15
|
+
export type IPMode = ValueOf<typeof IPMode>;
|
|
16
|
+
export declare const AddressTypes: {
|
|
17
|
+
readonly ADVERTISE: "Advertise";
|
|
18
|
+
readonly PUBLIC: "Public";
|
|
19
|
+
};
|
|
20
|
+
export type AddressTypes = ValueOf<typeof AddressTypes>;
|
|
21
|
+
export declare const IP_MODES: readonly ["v4", "v6"];
|
|
22
|
+
export declare const IP_MODE_TEXTS: {
|
|
23
|
+
readonly v4: "IPv4";
|
|
24
|
+
readonly v6: "IPv6";
|
|
25
|
+
};
|
|
26
|
+
export declare const NetworkMode: {
|
|
27
|
+
readonly DUAL: "dual";
|
|
28
|
+
readonly IPV4: "v4";
|
|
29
|
+
readonly IPV6: "v6";
|
|
30
|
+
};
|
|
31
|
+
export type NetworkMode = ValueOf<typeof NetworkMode>;
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} cidrStr cidrBlock, e.g. 10.16.0.0/24 may support ipv6
|
|
34
|
+
* @param {string} ipStr specific ip, e.g. 10.16.1.2 may support ipv6
|
|
35
|
+
* @param {IPMode} ipMode ip network mode ipv4/ipv6
|
|
36
|
+
* @return {boolean} whether ip belongs to cidr
|
|
37
|
+
*/
|
|
38
|
+
export declare function isBelongCidr(cidrStr: string, ipStr: string, ipMode?: IPMode): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} ip specific ip, e.g. 10.16.1.2
|
|
41
|
+
* @param {string} cidr specific cidr which ip may belongs to, e.g. 10.16.0.0/24
|
|
42
|
+
* @return {boolean} whether ip is broadcast address
|
|
43
|
+
*/
|
|
44
|
+
export declare function isBroadcastAddr(ipStr: string, cidrStr?: string, ipMode?: IPMode): boolean;
|
|
45
|
+
export declare function isLoopback(ipStr: string, ipMode?: IPMode): boolean;
|
|
46
|
+
export declare function isMultiBroadcast(ipStr: string, ipMode?: IPMode): boolean;
|
|
47
|
+
export declare function isLinkLocal(ipStr: string, ipMode?: IPMode): boolean;
|
|
48
|
+
export declare function isAllZero(ipStr: string, ipMode?: IPMode): boolean;
|
|
49
|
+
export declare function isNetworkAddr(ipStr: string, cidrStr?: string, ipMode?: IPMode): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} cidrAStr cidrBlock A, e.g. 10.16.0.0/24. support IPv6
|
|
52
|
+
* @param {string} cidrBStr cidrBlock B, e.g. 10.10.0.0/16. support IPv6
|
|
53
|
+
* @param {IPMode} ipMode ipMode, v4 or v6
|
|
54
|
+
* @return {boolean} whether 2 cidr blocks may conflict, judge by whether ip belongs to cidrBlock A may also belongs to B
|
|
55
|
+
*/
|
|
56
|
+
export declare function isCidrConflict(cidrAStr: string, cidrBStr: string, ipMode?: IPMode): boolean;
|
|
57
|
+
export declare function isCidrContain(cidrAStr: string, cidrBStr: string, ipMode?: IPMode): boolean;
|
|
58
|
+
export declare function getAddressBuilder(ipMode: IPMode): typeof Address6 | typeof Address4;
|
|
59
|
+
export declare const parseCIDR: (address: string, ipMode?: IPMode) => Address6 | Address4;
|
|
60
|
+
export declare function ipAddressEqual(ipAStr: string, ipBStr: string, ipMode?: IPMode): boolean;
|
|
61
|
+
export declare function isIpAddressValid(address: string, ipMode?: IPMode): boolean;
|
|
62
|
+
export declare function isCidrAddressValid(address: string, ipMode?: IPMode): boolean;
|
|
63
|
+
export declare function getCidrType(ip: string): "v4" | "v6";
|
|
64
|
+
export declare function isIpv4(value: string): boolean;
|
|
65
|
+
export declare function isIpv6(value: string): boolean;
|
|
66
|
+
export declare function ipAddress(value: string): string;
|
|
67
|
+
export declare function getStrictCidr(cidrStr: string, ipMode: IPMode): string;
|
|
68
|
+
export declare const parseSegment: (segment?: string, networkMode?: NetworkMode) => SegmentModel;
|
|
69
|
+
export declare function getCidrBlock(segment: string, networkType?: NetworkMode): string;
|
|
70
|
+
export declare function getCidrBlock({ ipV4Segment, ipV6Segment, }: SegmentModel): string;
|
|
71
|
+
export declare const DEFAULT_IPV4_MAX_CIDR_PREFIX = 31;
|
|
72
|
+
export declare const DEFAULT_IPV6_MAX_CIDR_PREFIX = 127;
|
|
73
|
+
export declare const DEFAULT_NETWORK_CIDR_PREFIX_MAPPER: {
|
|
74
|
+
readonly v4: 31;
|
|
75
|
+
readonly v6: 127;
|
|
76
|
+
};
|
|
77
|
+
export declare function getCidrMaximumPrefix(ipMode?: IPMode): 31 | 127;
|
|
78
|
+
export declare const adaptIpMode: (value: string, networkMode: NetworkMode) => "v4" | "v6";
|
|
79
|
+
export declare const isIpPartValid: (part: string, isIpV4: boolean) => boolean;
|
|
80
|
+
export declare const isIpPartsValid: (parts: string[], isIpV4: boolean) => boolean;
|
|
81
|
+
export declare const isIpInputValid: (input: string, isIpV4: boolean) => boolean;
|
|
82
|
+
export declare const getIpAddressSuggestionsByCidrs: (cidrs: string[], networkMode: NetworkMode, usedIps: string[], inputValue: string, isCalico: boolean, maxSize?: number) => string[];
|
|
83
|
+
export declare function adaptSubnetCidrs(cidrs: string, networkMode: NetworkMode, enableFixIpV6ForDual?: boolean): string[];
|
|
84
|
+
export declare function invalidIpOrder<T extends Address4 | Address6>(ipBegin: T, ipEnd: T): boolean;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum ClusterType {
|
|
2
|
+
Baremetal = "Baremetal",
|
|
3
|
+
Imported = "Imported",
|
|
4
|
+
OCP = "OCP",
|
|
5
|
+
AlibabaCloudACKDedicated = "AlibabaCloudACKDedicated",
|
|
6
|
+
AlibabaCloudACKManaged = "AlibabaCloudACKManaged",
|
|
7
|
+
AmazonEKS = "AmazonEKS",
|
|
8
|
+
AzureAKS = "AzureAKS",
|
|
9
|
+
GoogleCloudGKE = "GoogleCloudGKE",
|
|
10
|
+
HuaweiCloudCCE = "HuaweiCloudCCE",
|
|
11
|
+
TencentTKEManaged = "TencentTKEManaged",
|
|
12
|
+
TencentTKESelfDeployed = "TencentTKESelfDeployed"
|
|
13
|
+
}
|
|
14
|
+
export declare const isPublicCloud: (clusterType?: string) => boolean;
|