diff --git a/fullstack-network-manager/src/commands/flags.mjs b/fullstack-network-manager/src/commands/flags.mjs index e2dc2f503..6bcc12724 100644 --- a/fullstack-network-manager/src/commands/flags.mjs +++ b/fullstack-network-manager/src/commands/flags.mjs @@ -97,6 +97,15 @@ export const deployPrometheusStack = { } } +export const enablePrometheusSvcMonitor = { + name: 'enable-prometheus-svc-monitor', + definition: { + describe: 'Enable prometheus service monitor for the network nodes', + default: true, + type: 'boolean' + } +} + export const deployMinio = { name: 'minio', definition: { @@ -291,6 +300,7 @@ export const allFlags = [ deployJsonRpcRelay, valuesFile, deployPrometheusStack, + enablePrometheusSvcMonitor, deployMinio, deployCertManager, deployCertManagerCrds, diff --git a/fullstack-network-manager/src/commands/network.mjs b/fullstack-network-manager/src/commands/network.mjs index a3e334371..9aecbec10 100644 --- a/fullstack-network-manager/src/commands/network.mjs +++ b/fullstack-network-manager/src/commands/network.mjs @@ -52,7 +52,8 @@ export class NetworkCommand extends BaseCommand { } prepareValuesArg (chartDir, valuesFile, deployMirrorNode, deployHederaExplorer, tlsClusterIssuerType, - enableHederaExplorerTls, namespace, hederaExplorerTlsLoadBalancerIp, hederaExplorerTlsHostName) { + enableHederaExplorerTls, namespace, hederaExplorerTlsLoadBalancerIp, hederaExplorerTlsHostName, + enablePrometheusSvcMonitor) { let valuesArg = '' if (chartDir) { valuesArg = `-f ${chartDir}/fullstack-deployment/values.yaml` @@ -61,6 +62,7 @@ export class NetworkCommand extends BaseCommand { valuesArg += this.prepareValuesFiles(valuesFile) valuesArg += ` --set hedera-mirror-node.enabled=${deployMirrorNode} --set hedera-explorer.enabled=${deployHederaExplorer}` + valuesArg += ` --set telemetry.prometheus.svcMonitor.enabled=${enablePrometheusSvcMonitor}` if (enableHederaExplorerTls) { valuesArg += this.getTlsValueArguments(tlsClusterIssuerType, enableHederaExplorerTls, namespace, @@ -82,6 +84,7 @@ export class NetworkCommand extends BaseCommand { const enableHederaExplorerTls = this.configManager.getFlag(flags.enableHederaExplorerTls) const hederaExplorerTlsLoadBalancerIp = this.configManager.getFlag(flags.hederaExplorerTlsLoadBalancerIp) const hederaExplorerTlsHostName = this.configManager.getFlag(flags.hederaExplorerTlsHostName) + const enablePrometheusSvcMonitor = this.configManager.getFlag(flags.enablePrometheusSvcMonitor) // prompt if values are missing and create a config object const config = { @@ -95,6 +98,7 @@ export class NetworkCommand extends BaseCommand { enableHederaExplorerTls: await prompts.promptEnableHederaExplorerTls(task, enableHederaExplorerTls), hederaExplorerTlsLoadBalancerIp: await prompts.promptHederaExplorerTlsLoadBalancerIp(task, hederaExplorerTlsLoadBalancerIp), hederaExplorerTlsHostName: await prompts.promptHederaExplorerTlsHostName(task, hederaExplorerTlsHostName), + enablePrometheusSvcMonitor: await prompts.promptEnablePrometheusSvcMonitor(task, enablePrometheusSvcMonitor), version: this.configManager.getVersion() } @@ -105,7 +109,7 @@ export class NetworkCommand extends BaseCommand { config.valuesArg = this.prepareValuesArg(config.chartDir, config.valuesFile, config.deployMirrorNode, config.deployHederaExplorer, config.tlsClusterIssuerType, config.enableHederaExplorerTls, config.namespace, - config.hederaExplorerTlsLoadBalancerIp, config.hederaExplorerTlsHostName) + config.hederaExplorerTlsLoadBalancerIp, config.hederaExplorerTlsHostName, config.enablePrometheusSvcMonitor) return config } @@ -319,7 +323,8 @@ export class NetworkCommand extends BaseCommand { flags.tlsClusterIssuerType, flags.enableHederaExplorerTls, flags.hederaExplorerTlsLoadBalancerIp, - flags.hederaExplorerTlsHostName + flags.hederaExplorerTlsHostName, + flags.enablePrometheusSvcMonitor ) }, handler: argv => { @@ -370,7 +375,8 @@ export class NetworkCommand extends BaseCommand { flags.tlsClusterIssuerType, flags.enableHederaExplorerTls, flags.hederaExplorerTlsLoadBalancerIp, - flags.hederaExplorerTlsHostName + flags.hederaExplorerTlsHostName, + flags.enablePrometheusSvcMonitor ), handler: argv => { networkCmd.logger.debug("==== Running 'chart upgrade' ===") diff --git a/fullstack-network-manager/src/commands/prompts.mjs b/fullstack-network-manager/src/commands/prompts.mjs index c1428523b..84284630c 100644 --- a/fullstack-network-manager/src/commands/prompts.mjs +++ b/fullstack-network-manager/src/commands/prompts.mjs @@ -255,6 +255,22 @@ export async function promptDeployPrometheusStack (task, input) { } } +export async function promptEnablePrometheusSvcMonitor (task, input) { + try { + if (input === undefined) { + input = await task.prompt(ListrEnquirerPromptAdapter).run({ + type: 'toggle', + default: flags.enablePrometheusSvcMonitor.definition.default, + message: 'Would you like to enable the Prometheus service monitor for the network nodes?' + }) + } + + return input + } catch (e) { + throw new FullstackTestingError(`input failed: ${flags.enablePrometheusSvcMonitor.name}`, e) + } +} + export async function promptDeployMinio (task, input) { try { if (input === undefined) {