Skip to content

Commit

Permalink
enablePrometheusSvcMonitor
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Jan 26, 2024
1 parent 2eedc70 commit ba87c3c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
10 changes: 10 additions & 0 deletions fullstack-network-manager/src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -291,6 +300,7 @@ export const allFlags = [
deployJsonRpcRelay,
valuesFile,
deployPrometheusStack,
enablePrometheusSvcMonitor,
deployMinio,
deployCertManager,
deployCertManagerCrds,
Expand Down
14 changes: 10 additions & 4 deletions fullstack-network-manager/src/commands/network.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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,
Expand All @@ -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 = {
Expand All @@ -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()
}

Expand All @@ -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
}
Expand Down Expand Up @@ -319,7 +323,8 @@ export class NetworkCommand extends BaseCommand {
flags.tlsClusterIssuerType,
flags.enableHederaExplorerTls,
flags.hederaExplorerTlsLoadBalancerIp,
flags.hederaExplorerTlsHostName
flags.hederaExplorerTlsHostName,
flags.enablePrometheusSvcMonitor
)
},
handler: argv => {
Expand Down Expand Up @@ -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' ===")
Expand Down
16 changes: 16 additions & 0 deletions fullstack-network-manager/src/commands/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ba87c3c

Please sign in to comment.