Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Setup mirror node monitor pinger service #893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/commands/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

/**
* Set flag from the flag option
* @param y instance of yargs

Check warning on line 25 in src/commands/flags.ts

View workflow job for this annotation

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
* @param commandFlags a set of command flags

Check warning on line 26 in src/commands/flags.ts

View workflow job for this annotation

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
*
*/
export function setCommandFlags (y: any, ...commandFlags: CommandFlag[]) {
Expand Down Expand Up @@ -768,6 +768,16 @@
}
}

export const pinger: CommandFlag = {
constName: 'pinger',
name: 'pinger',
definition: {
describe: 'Enable Pinger service in the Mirror node monitor',
defaultValue: false,
type: 'boolean'
}
}

//* ------------- Node Proxy Certificates ------------- !//

export const grpcTlsCertificatePath: CommandFlag = {
Expand Down Expand Up @@ -889,6 +899,7 @@
privateKey,
profileFile,
profileName,
pinger,
relayReleaseTag,
releaseTag,
replicaCount,
Expand Down
23 changes: 20 additions & 3 deletions src/commands/mirror_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export class MirrorNodeCommand extends BaseCommand {
flags.quiet,
flags.tlsClusterIssuerType,
flags.valuesFile,
flags.mirrorNodeVersion
flags.mirrorNodeVersion,
flags.pinger
]
}

Expand Down Expand Up @@ -147,7 +148,8 @@ export class MirrorNodeCommand extends BaseCommand {
chartPath: string
valuesArg: string
mirrorNodeVersion: string
getUnusedConfigs: () => string[]
getUnusedConfigs: () => string[],
pinger: boolean
}

interface Context {
Expand All @@ -171,7 +173,8 @@ export class MirrorNodeCommand extends BaseCommand {
flags.hederaExplorerVersion,
flags.tlsClusterIssuerType,
flags.valuesFile,
flags.mirrorNodeVersion
flags.mirrorNodeVersion,
flags.pinger
])

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

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

if (ctx.config.pinger) {
const startAccId = constants.HEDERA_NODE_ACCOUNT_ID_START
const networkPods = await this.k8.getPodsByLabel(['solo.hedera.com/type=network-node'])

if (networkPods.length) {
const pod = networkPods[0]
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.nodes.0.accountId=${startAccId}`
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.nodes.0.host=${pod.status.podIP}`

ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.accountId=${constants.OPERATOR_ID}`
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${constants.OPERATOR_KEY}`
}
}

if (!await self.k8.hasNamespace(ctx.config.namespace)) {
throw new SoloError(`namespace ${ctx.config.namespace} does not exist`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@
config.namespace,
constants.SOLO_DEPLOYMENT_CHART,
constants.SOLO_TESTING_CHART_URL + constants.SOLO_DEPLOYMENT_CHART,
config.valuesArg,
config.soloChartVersion
config.soloChartVersion,
config.valuesArg

Check warning on line 571 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L570-L571

Added lines #L570 - L571 were not covered by tests
)
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/commands/node/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,8 @@ export class NodeCommandTasks {
await self.chartManager.upgrade(
config.namespace,
constants.SOLO_DEPLOYMENT_CHART, constants.SOLO_TESTING_CHART_URL + constants.SOLO_DEPLOYMENT_CHART,
valuesArg,
config.soloChartVersion
config.soloChartVersion,
valuesArg
)
}, skip)
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/chart_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class ChartManager {
return true
}

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

try {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/commands/mirror_node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ argv[flags.relayReleaseTag.name] = flags.relayReleaseTag.definition.defaultValue
// set the env variable SOLO_CHARTS_DIR if developer wants to use local Solo charts
argv[flags.chartDirectory.name] = process.env.SOLO_CHARTS_DIR ?? undefined
argv[flags.quiet.name] = true
argv[flags.pinger.name] = true

e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefined, undefined, true, (bootstrapResp) => {
describe('MirrorNodeCommand', async () => {
Expand Down
Loading