-
Notifications
You must be signed in to change notification settings - Fork 38
/
node-config.ts
225 lines (211 loc) · 10.6 KB
/
node-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* Copyright OpenSearch Contributors
SPDX-License-Identifier: Apache-2.0
The OpenSearch Contributors require contributions made to
this file be licensed under the Apache-2.0 license or a
compatible open source license. */
import { InstanceClass, InstanceSize, InstanceType } from 'aws-cdk-lib/aws-ec2';
import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-autoscaling';
export const nodeConfig = new Map<string, object>();
nodeConfig.set('manager', {
'node.roles': ['cluster_manager'],
});
nodeConfig.set('data', {
'node.roles': ['data', 'ingest'],
});
nodeConfig.set('seed-manager', {
'node.name': 'seed',
'node.roles': ['cluster_manager'],
});
nodeConfig.set('seed-data', {
'node.name': 'seed',
'node.roles': ['cluster_manager', 'data'],
});
nodeConfig.set('client', {
'node.name': 'client-node',
'node.roles': [],
});
nodeConfig.set('ml', {
'node.name': 'ml-node',
'node.roles': ['ml'],
});
export enum x64Ec2InstanceType {
M5_XLARGE = 'm5.xlarge',
M5_2XLARGE = 'm5.2xlarge',
C5_LARGE = 'c5.large',
C5_XLARGE = 'c5.xlarge',
C5_2XLARGE = 'c5.2xlarge',
C5D_XLARGE = 'c5d.xlarge',
C5D_2XLARGE = 'c5d.2xlarge',
R5_LARGE = 'r5.large',
R5_XLARGE = 'r5.xlarge',
R5_2XLARGE = 'r5.2xlarge',
R5_4XLARGE = 'r5.4xlarge',
R5_8XLARGE = 'r5.8xlarge',
R5D_XLARGE = 'r5d.xlarge',
R5D_2XLARGE = 'r5d.2xlarge',
R5D_4XLARGE = 'r5d.4xlarge',
R5D_8XLARGE = 'r5d.8xlarge',
G5_LARGE = 'g5.large',
G5_XLARGE = 'g5.xlarge',
I3_LARGE = 'i3.large',
I3_XLARGE = 'i3.xlarge',
I3_2XLARGE = 'i3.2xlarge',
I3_4XLARGE = 'i3.4xlarge',
I3_8XLARGE = 'i3.8xlarge',
INF1_XLARGE = 'inf1.xlarge',
INF1_2XLARGE = 'inf1.2xlarge'
}
export enum arm64Ec2InstanceType {
M6G_XLARGE = 'm6g.xlarge',
M6G_2XLARGE = 'm6g.2xlarge',
C6G_LARGE = 'c6g.large',
C6G_XLARGE = 'c6g.xlarge',
C6G_2XLARGE = 'c6g.2xlarge',
C6GD_XLARGE = 'c6gd.xlarge',
C6GD_2XLARGE = 'c6gd.2xlarge',
C6GD_4XLARGE = 'c6gd.4xlarge',
C6GD_8XLARGE = 'c6gd.8xlarge',
R6G_LARGE = 'r6g.large',
R6G_XLARGE = 'r6g.xlarge',
R6G_2XLARGE = 'r6g.2xlarge',
R6G_4XLARGE = 'r6g.4xlarge',
R6G_8XLARGE = 'r6g.8xlarge',
R6GD_XLARGE = 'r6gd.xlarge',
R6GD_2XLARGE = 'r6gd.2xlarge',
R6GD_4XLARGE = 'r6gd.4xlarge',
R6GD_8XLARGE = 'r6gd.8xlarge',
R7GD_XLARGE = 'r7gd.xlarge',
R7GD_2XLARGE = 'r7gd.2xlarge',
R7GD_4XLARGE = 'r7gd.4xlarge',
R7GD_8XLARGE = 'r7gd.8xlarge',
G5G_LARGE = 'g5g.large',
G5G_XLARGE = 'g5g.xlarge'
}
export interface InstanceTypeInfo {
instance: InstanceType;
hasInternalStorage: boolean;
}
export const getX64InstanceTypes = (instanceType: string): InstanceTypeInfo => {
switch (instanceType) {
case x64Ec2InstanceType.M5_XLARGE:
return { instance: InstanceType.of(InstanceClass.M5, InstanceSize.XLARGE), hasInternalStorage: false };
case x64Ec2InstanceType.M5_2XLARGE:
return { instance: InstanceType.of(InstanceClass.M5, InstanceSize.XLARGE2), hasInternalStorage: false };
case x64Ec2InstanceType.C5_LARGE:
return { instance: InstanceType.of(InstanceClass.C5, InstanceSize.LARGE), hasInternalStorage: false };
case x64Ec2InstanceType.C5_XLARGE:
return { instance: InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE), hasInternalStorage: false };
case x64Ec2InstanceType.C5_2XLARGE:
return { instance: InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE2), hasInternalStorage: false };
case x64Ec2InstanceType.C5D_XLARGE:
return { instance: InstanceType.of(InstanceClass.C5D, InstanceSize.XLARGE), hasInternalStorage: true };
case x64Ec2InstanceType.C5D_2XLARGE:
return { instance: InstanceType.of(InstanceClass.C5D, InstanceSize.XLARGE2), hasInternalStorage: true };
case x64Ec2InstanceType.R5_LARGE:
return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.LARGE), hasInternalStorage: false };
case x64Ec2InstanceType.R5_XLARGE:
return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE), hasInternalStorage: false };
case x64Ec2InstanceType.R5_2XLARGE:
return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE), hasInternalStorage: false };
case x64Ec2InstanceType.R5_4XLARGE:
return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE4), hasInternalStorage: false };
case x64Ec2InstanceType.R5_8XLARGE:
return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE8), hasInternalStorage: false };
case x64Ec2InstanceType.R5D_XLARGE:
return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE), hasInternalStorage: true };
case x64Ec2InstanceType.R5D_2XLARGE:
return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE2), hasInternalStorage: true };
case x64Ec2InstanceType.R5D_4XLARGE:
return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE4), hasInternalStorage: true };
case x64Ec2InstanceType.R5D_8XLARGE:
return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE8), hasInternalStorage: true };
case x64Ec2InstanceType.G5_LARGE:
return { instance: InstanceType.of(InstanceClass.G5, InstanceSize.LARGE), hasInternalStorage: true };
case x64Ec2InstanceType.G5_XLARGE:
return { instance: InstanceType.of(InstanceClass.G5, InstanceSize.XLARGE), hasInternalStorage: true };
case x64Ec2InstanceType.I3_LARGE:
return { instance: InstanceType.of(InstanceClass.I3, InstanceSize.LARGE), hasInternalStorage: true };
case x64Ec2InstanceType.I3_XLARGE:
return { instance: InstanceType.of(InstanceClass.I3, InstanceSize.XLARGE), hasInternalStorage: true };
case x64Ec2InstanceType.I3_2XLARGE:
return { instance: InstanceType.of(InstanceClass.I3, InstanceSize.XLARGE2), hasInternalStorage: true };
case x64Ec2InstanceType.I3_4XLARGE:
return { instance: InstanceType.of(InstanceClass.I3, InstanceSize.XLARGE4), hasInternalStorage: true };
case x64Ec2InstanceType.I3_8XLARGE:
return { instance: InstanceType.of(InstanceClass.I3, InstanceSize.XLARGE8), hasInternalStorage: true };
case x64Ec2InstanceType.INF1_XLARGE:
return { instance: InstanceType.of(InstanceClass.INF1, InstanceSize.XLARGE), hasInternalStorage: false };
case x64Ec2InstanceType.INF1_2XLARGE:
return { instance: InstanceType.of(InstanceClass.INF1, InstanceSize.XLARGE2), hasInternalStorage: false };
default:
throw new Error(`Invalid instance type provided, please provide any one the following: ${Object.values(x64Ec2InstanceType)}`);
}
};
export const getArm64InstanceTypes = (instanceType: string): InstanceTypeInfo => {
switch (instanceType) {
case arm64Ec2InstanceType.M6G_XLARGE:
return { instance: InstanceType.of(InstanceClass.M6G, InstanceSize.XLARGE), hasInternalStorage: false };
case arm64Ec2InstanceType.M6G_2XLARGE:
return { instance: InstanceType.of(InstanceClass.M6G, InstanceSize.XLARGE2), hasInternalStorage: false };
case arm64Ec2InstanceType.C6G_LARGE:
return { instance: InstanceType.of(InstanceClass.C6G, InstanceSize.LARGE), hasInternalStorage: false };
case arm64Ec2InstanceType.C6G_XLARGE:
return { instance: InstanceType.of(InstanceClass.C6G, InstanceSize.XLARGE), hasInternalStorage: false };
case arm64Ec2InstanceType.C6G_2XLARGE:
return { instance: InstanceType.of(InstanceClass.C6G, InstanceSize.XLARGE2), hasInternalStorage: false };
case arm64Ec2InstanceType.C6GD_XLARGE:
return { instance: InstanceType.of(InstanceClass.C6GD, InstanceSize.XLARGE), hasInternalStorage: true };
case arm64Ec2InstanceType.C6GD_2XLARGE:
return { instance: InstanceType.of(InstanceClass.C6GD, InstanceSize.XLARGE2), hasInternalStorage: true };
case arm64Ec2InstanceType.C6GD_4XLARGE:
return { instance: InstanceType.of(InstanceClass.C6GD, InstanceSize.XLARGE4), hasInternalStorage: true };
case arm64Ec2InstanceType.C6GD_8XLARGE:
return { instance: InstanceType.of(InstanceClass.C6GD, InstanceSize.XLARGE8), hasInternalStorage: true };
case arm64Ec2InstanceType.R6G_LARGE:
return { instance: InstanceType.of(InstanceClass.R6G, InstanceSize.LARGE), hasInternalStorage: false };
case arm64Ec2InstanceType.R6G_XLARGE:
return { instance: InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE), hasInternalStorage: false };
case arm64Ec2InstanceType.R6G_2XLARGE:
return { instance: InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE2), hasInternalStorage: false };
case arm64Ec2InstanceType.R6G_4XLARGE:
return { instance: InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE4), hasInternalStorage: false };
case arm64Ec2InstanceType.R6G_8XLARGE:
return { instance: InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE8), hasInternalStorage: false };
case arm64Ec2InstanceType.R6GD_XLARGE:
return { instance: InstanceType.of(InstanceClass.R6GD, InstanceSize.XLARGE), hasInternalStorage: true };
case arm64Ec2InstanceType.R6GD_2XLARGE:
return { instance: InstanceType.of(InstanceClass.R6GD, InstanceSize.XLARGE2), hasInternalStorage: true };
case arm64Ec2InstanceType.R6GD_4XLARGE:
return { instance: InstanceType.of(InstanceClass.R6GD, InstanceSize.XLARGE4), hasInternalStorage: true };
case arm64Ec2InstanceType.R6GD_8XLARGE:
return { instance: InstanceType.of(InstanceClass.R6GD, InstanceSize.XLARGE8), hasInternalStorage: true };
case arm64Ec2InstanceType.R7GD_XLARGE:
return { instance: InstanceType.of(InstanceClass.R7GD, InstanceSize.XLARGE), hasInternalStorage: true };
case arm64Ec2InstanceType.R7GD_2XLARGE:
return { instance: InstanceType.of(InstanceClass.R7GD, InstanceSize.XLARGE2), hasInternalStorage: true };
case arm64Ec2InstanceType.R7GD_4XLARGE:
return { instance: InstanceType.of(InstanceClass.R7GD, InstanceSize.XLARGE4), hasInternalStorage: true };
case arm64Ec2InstanceType.R7GD_8XLARGE:
return { instance: InstanceType.of(InstanceClass.R7GD, InstanceSize.XLARGE8), hasInternalStorage: true };
case arm64Ec2InstanceType.G5G_LARGE:
return { instance: InstanceType.of(InstanceClass.G5G, InstanceSize.LARGE), hasInternalStorage: true };
case arm64Ec2InstanceType.G5G_XLARGE:
return { instance: InstanceType.of(InstanceClass.G5G, InstanceSize.XLARGE), hasInternalStorage: true };
default:
throw new Error(`Invalid instance type provided, please provide any one the following: ${Object.values(arm64Ec2InstanceType)}`);
}
};
export const getVolumeType = (volumeType: string) => {
switch (volumeType) {
case EbsDeviceVolumeType.STANDARD.valueOf():
return EbsDeviceVolumeType.STANDARD;
case EbsDeviceVolumeType.GP2.valueOf():
return EbsDeviceVolumeType.GP2;
case EbsDeviceVolumeType.GP3.valueOf():
return EbsDeviceVolumeType.GP3;
case EbsDeviceVolumeType.IO1.valueOf():
return EbsDeviceVolumeType.IO1;
default:
throw new Error('Invalid volume type provided, please provide any one of the following: standard, gp2, gp3');
}
};