Skip to content

Commit 253b475

Browse files
committed
feat: first implementation of resource profile manager
Signed-off-by: Lenin Mehedy <[email protected]>
1 parent d90f7b6 commit 253b475

11 files changed

+413
-135
lines changed

package-lock.json

Lines changed: 30 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"got": "^14.2.0",
4040
"inquirer": "^9.2.15",
4141
"js-base64": "^3.7.7",
42+
"js-yaml": "^4.1.0",
4243
"listr2": "^8.0.2",
4344
"semver": "^7.6.0",
4445
"stream-buffers": "^3.0.2",

resources/custom-spec.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
large:
2+
consensus:
3+
resources:
4+
limits:
5+
cpu: 42
6+
memory: 224G
7+
containers:
8+
root:
9+
resources:
10+
limits:
11+
cpu: 34
12+
memory: 184G
13+
recordStreamUploader:
14+
resources:
15+
limits:
16+
cpu: 2
17+
memory: 8G
18+
eventStreamUploader:
19+
resources:
20+
limits:
21+
cpu: 2
22+
memory: 8G
23+
accountBalanceUploader:
24+
resources:
25+
limits:
26+
cpu: 2
27+
memory: 8G
28+
backupUploader:
29+
resources:
30+
limits:
31+
cpu: 2
32+
memory: 8G
33+
otelCollector:
34+
resources:
35+
limits:
36+
cpu: 2
37+
memory: 8G
38+
rpcRelay:
39+
resources:
40+
limits:
41+
cpu: 2
42+
memory: 8G
43+
haproxy:
44+
resources:
45+
limits:
46+
cpu: 2
47+
memory: 16G
48+
envoyProxy:
49+
resources:
50+
limits:
51+
cpu: 2
52+
memory: 16G
53+
mirror:
54+
postgresql:
55+
resources:
56+
limits:
57+
cpu: 12
58+
memory: 32G
59+
importer:
60+
resources:
61+
limits:
62+
cpu: 4
63+
memory: 16G
64+
rest:
65+
resources:
66+
limits:
67+
cpu: 1
68+
memory: 2G
69+
grpc:
70+
resources:
71+
limits:
72+
cpu: 1
73+
memory: 2G
74+
web3:
75+
resources:
76+
limits:
77+
cpu: 2
78+
memory: 8G
79+
monitor:
80+
resources:
81+
limits:
82+
cpu: 2
83+
memory: 8G
84+
minio:
85+
operator:
86+
resources:
87+
limits:
88+
cpu: 1
89+
memory: 2G
90+
tenant:
91+
size: 100G # volume
92+
resources:
93+
limits:
94+
cpu: 12
95+
memory: 32G

resources/cutom-spec.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/commands/flags.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const profileFile = {
108108
}
109109
}
110110

111-
export const profile = {
111+
export const profileName = {
112112
name: 'profile',
113113
definition: {
114114
describe: 'Resource profile for the fullstack network deployment (large | medium | small | tiny|',
@@ -486,7 +486,7 @@ export const allFlags = [
486486
amount,
487487
applicationEnv,
488488
profileFile,
489-
profile
489+
profileName
490490
]
491491

492492
export const allFlagsMap = new Map(allFlags.map(f => [f.name, f]))

src/commands/network.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class NetworkCommand extends BaseCommand {
115115
flags.hederaExplorerTlsHostName,
116116
flags.enablePrometheusSvcMonitor,
117117
flags.profileFile,
118-
flags.profile
118+
flags.profileName
119119
]
120120

121121
this.configManager.update(argv)
@@ -362,7 +362,7 @@ export class NetworkCommand extends BaseCommand {
362362
flags.enablePrometheusSvcMonitor,
363363
flags.fstChartVersion,
364364
flags.profileFile,
365-
flags.profile
365+
flags.profileName
366366
),
367367
handler: argv => {
368368
networkCmd.logger.debug("==== Running 'network deploy' ===")

src/commands/prompts.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ export async function promptProfileFile (task, input) {
172172
return input
173173
}
174174

175-
export async function promptProfile (task, input, choices = [
176-
constants.PROFILE_TINY, constants.PROFILE_SMALL, constants.PROFILE_MEDIUM, constants.PROFILE_LARGE]) {
175+
export async function promptProfile (task, input, choices = constants.DEFAULT_PROFILES) {
177176
try {
178177
const initial = choices.indexOf(input)
179178
if (initial < 0) {

src/core/constants.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ export const PROFILE_LARGE = 'large'
130130
export const PROFILE_MEDIUM = 'medium'
131131
export const PROFILE_SMALL = 'small'
132132
export const PROFILE_TINY = 'tiny'
133+
134+
export const DEFAULT_PROFILES = [PROFILE_TINY, PROFILE_SMALL, PROFILE_MEDIUM, PROFILE_LARGE]
135+
export const DEFAULT_PROFILE_FILE = `${RESOURCES_DIR}/custom-spec.yaml`

0 commit comments

Comments
 (0)