Skip to content

Commit f4c4320

Browse files
authored
feat: Setup mirror node monitor pinger service (#893)
Signed-off-by: Ivo Yankov <[email protected]>
1 parent 4d49c53 commit f4c4320

File tree

6 files changed

+37
-8
lines changed

6 files changed

+37
-8
lines changed

src/commands/flags.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,16 @@ export const deploymentClusters: CommandFlag = {
768768
}
769769
}
770770

771+
export const pinger: CommandFlag = {
772+
constName: 'pinger',
773+
name: 'pinger',
774+
definition: {
775+
describe: 'Enable Pinger service in the Mirror node monitor',
776+
defaultValue: false,
777+
type: 'boolean'
778+
}
779+
}
780+
771781
//* ------------- Node Proxy Certificates ------------- !//
772782

773783
export const grpcTlsCertificatePath: CommandFlag = {
@@ -889,6 +899,7 @@ export const allFlags: CommandFlag[] = [
889899
privateKey,
890900
profileFile,
891901
profileName,
902+
pinger,
892903
relayReleaseTag,
893904
releaseTag,
894905
replicaCount,

src/commands/mirror_node.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export class MirrorNodeCommand extends BaseCommand {
5757
flags.quiet,
5858
flags.tlsClusterIssuerType,
5959
flags.valuesFile,
60-
flags.mirrorNodeVersion
60+
flags.mirrorNodeVersion,
61+
flags.pinger
6162
]
6263
}
6364

@@ -147,7 +148,8 @@ export class MirrorNodeCommand extends BaseCommand {
147148
chartPath: string
148149
valuesArg: string
149150
mirrorNodeVersion: string
150-
getUnusedConfigs: () => string[]
151+
getUnusedConfigs: () => string[],
152+
pinger: boolean
151153
}
152154

153155
interface Context {
@@ -171,7 +173,8 @@ export class MirrorNodeCommand extends BaseCommand {
171173
flags.hederaExplorerVersion,
172174
flags.tlsClusterIssuerType,
173175
flags.valuesFile,
174-
flags.mirrorNodeVersion
176+
flags.mirrorNodeVersion,
177+
flags.pinger
175178
])
176179

177180
await prompts.execute(task, self.configManager, MirrorNodeCommand.DEPLOY_FLAGS_LIST)
@@ -186,6 +189,20 @@ export class MirrorNodeCommand extends BaseCommand {
186189

187190
ctx.config.valuesArg += this.prepareValuesFiles(constants.MIRROR_NODE_VALUES_FILE)
188191

192+
if (ctx.config.pinger) {
193+
const startAccId = constants.HEDERA_NODE_ACCOUNT_ID_START
194+
const networkPods = await this.k8.getPodsByLabel(['solo.hedera.com/type=network-node'])
195+
196+
if (networkPods.length) {
197+
const pod = networkPods[0]
198+
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.nodes.0.accountId=${startAccId}`
199+
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.nodes.0.host=${pod.status.podIP}`
200+
201+
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.accountId=${constants.OPERATOR_ID}`
202+
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${constants.OPERATOR_KEY}`
203+
}
204+
}
205+
189206
if (!await self.k8.hasNamespace(ctx.config.namespace)) {
190207
throw new SoloError(`namespace ${ctx.config.namespace} does not exist`)
191208
}

src/commands/network.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ export class NetworkCommand extends BaseCommand {
567567
config.namespace,
568568
constants.SOLO_DEPLOYMENT_CHART,
569569
constants.SOLO_TESTING_CHART_URL + constants.SOLO_DEPLOYMENT_CHART,
570-
config.valuesArg,
571-
config.soloChartVersion
570+
config.soloChartVersion,
571+
config.valuesArg
572572
)
573573
}
574574
},

src/commands/node/tasks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,8 @@ export class NodeCommandTasks {
12361236
await self.chartManager.upgrade(
12371237
config.namespace,
12381238
constants.SOLO_DEPLOYMENT_CHART, constants.SOLO_TESTING_CHART_URL + constants.SOLO_DEPLOYMENT_CHART,
1239-
valuesArg,
1240-
config.soloChartVersion
1239+
config.soloChartVersion,
1240+
valuesArg
12411241
)
12421242
}, skip)
12431243
}

src/core/chart_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class ChartManager {
113113
return true
114114
}
115115

116-
async upgrade (namespaceName: string, chartReleaseName: string, chartPath: string, valuesArg = '', version = '') {
116+
async upgrade (namespaceName: string, chartReleaseName: string, chartPath: string, version = '', valuesArg = '') {
117117
const versionArg = version ? `--version ${version}` : ''
118118

119119
try {

test/e2e/commands/mirror_node.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ argv[flags.relayReleaseTag.name] = flags.relayReleaseTag.definition.defaultValue
5151
// set the env variable SOLO_CHARTS_DIR if developer wants to use local Solo charts
5252
argv[flags.chartDirectory.name] = process.env.SOLO_CHARTS_DIR ?? undefined
5353
argv[flags.quiet.name] = true
54+
argv[flags.pinger.name] = true
5455

5556
e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefined, undefined, true, (bootstrapResp) => {
5657
describe('MirrorNodeCommand', async () => {

0 commit comments

Comments
 (0)