Skip to content

Commit

Permalink
created new aliases for (pod name, node alias, node id), renamed all …
Browse files Browse the repository at this point in the history
…references appropriately, renamed const values of the flags ( nodeIDs & nodeID ) --> ( nodeAliasesUnparsed & nodeAlias ) for internal use to reflect their actual usage and value

Signed-off-by: instamenta <[email protected]>
  • Loading branch information
instamenta committed Sep 25, 2024
1 parent ed4ed88 commit 70cfbad
Show file tree
Hide file tree
Showing 29 changed files with 584 additions and 542 deletions.
16 changes: 8 additions & 8 deletions src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ export const cacheDir = {
}

/** @type {CommandFlag} **/
export const nodeIDs = {
constName: 'nodeIDs',
export const nodeAliasesUnparsed = {
constName: 'nodeAliasesUnparsed',
name: 'node-ids',
definition: {
describe: 'Comma separated node IDs (empty means all nodes)',
describe: 'Comma separated node aliases (empty means all nodes)',
alias: 'i',
type: 'string'
}
Expand Down Expand Up @@ -660,11 +660,11 @@ export const amount = {
}

/** @type {CommandFlag} **/
export const nodeID = {
constName: 'nodeId',
export const nodeAlias = {
constName: 'nodeAlias',
name: 'node-id',
definition: {
describe: 'Node id (e.g. node99)',
describe: 'Node alias (e.g. node99)',
type: 'string'
}
}
Expand Down Expand Up @@ -808,8 +808,8 @@ export const allFlags = [
namespace,
newAccountNumber,
newAdminKey,
nodeID,
nodeIDs,
nodeAlias,
nodeAliasesUnparsed,
operatorId,
operatorKey,
persistentVolumeClaims,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class InitCommand extends BaseCommand {
flags.clusterSetupNamespace,
flags.fstChartVersion,
flags.namespace,
flags.nodeIDs,
flags.nodeAliasesUnparsed,
flags.profileFile,
flags.profileName,
flags.releaseTag
Expand Down
34 changes: 17 additions & 17 deletions src/commands/network.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class NetworkCommand extends BaseCommand {
flags.debugNodeId,
flags.log4j2Xml,
flags.namespace,
flags.nodeIDs,
flags.nodeAliasesUnparsed,
flags.persistentVolumeClaims,
flags.profileFile,
flags.profileName,
Expand All @@ -93,7 +93,7 @@ export class NetworkCommand extends BaseCommand {
}

if (config.app !== constants.HEDERA_APP_NAME) {
const index = config.nodeIds.length
const index = config.nodeAliases.length
for (let i = 0; i < index; i++) {
valuesArg += ` --set "hedera.nodes[${i}].root.extraEnv[0].name=JAVA_MAIN_CLASS"`
valuesArg += ` --set "hedera.nodes[${i}].root.extraEnv[0].value=com.swirlds.platform.Browser"`
Expand Down Expand Up @@ -165,15 +165,15 @@ export class NetworkCommand extends BaseCommand {
* @property {boolean} enablePrometheusSvcMonitor
* @property {string} fstChartVersion
* @property {string} namespace
* @property {string} nodeIDs
* @property {string} nodeAliasesUnparsed
* @property {string} persistentVolumeClaims
* @property {string} profileFile
* @property {string} profileName
* @property {string} releaseTag
* -- extra args --
* @property {string} chartPath
* @property {string} keysDir
* @property {string[]} nodeIds
* @property {NodeAliases} nodeAliases
* @property {string} stagingDir
* @property {string} stagingKeysDir
* @property {string} valuesArg
Expand All @@ -190,13 +190,13 @@ export class NetworkCommand extends BaseCommand {
[
'chartPath',
'keysDir',
'nodeIds',
'nodeAliases',
'stagingDir',
'stagingKeysDir',
'valuesArg'
])

config.nodeIds = helpers.parseNodeIds(config.nodeIDs)
config.nodeAliases = helpers.parseNodeAliases(config.nodeAliasesUnparsed)

// compute values
config.chartPath = await this.prepareChartPath(config.chartDirectory,
Expand Down Expand Up @@ -257,15 +257,15 @@ export class NetworkCommand extends BaseCommand {
task: async (ctx, _) => {
const config = /** @type {NetworkDeployConfigClass} **/ ctx.config

await this.keyManager.copyGossipKeysToStaging(config.keysDir, config.stagingKeysDir, config.nodeIds)
await this.keyManager.copyGossipKeysToStaging(config.keysDir, config.stagingKeysDir, config.nodeAliases)
}
},
{
title: 'Copy gRPC TLS keys to staging',
task: async (ctx, _) => {
const config = /** @type {NetworkDeployConfigClass} **/ ctx.config
for (const nodeId of config.nodeIds) {
const tlsKeyFiles = self.keyManager.prepareTLSKeyFilePaths(nodeId, config.keysDir)
for (const nodeAlias of config.nodeAliases) {
const tlsKeyFiles = self.keyManager.prepareTLSKeyFilePaths(nodeAlias, config.keysDir)
await self.keyManager.copyNodeKeysToStaging(tlsKeyFiles, config.stagingKeysDir)
}
}
Expand All @@ -283,7 +283,7 @@ export class NetworkCommand extends BaseCommand {
task: async (ctx, parentTask) => {
const config = /** @type {NetworkDeployConfigClass} **/ ctx.config

const subTasks = self.platformInstaller.copyNodeKeys(config.stagingDir, config.nodeIds)
const subTasks = self.platformInstaller.copyNodeKeys(config.stagingDir, config.nodeAliases)

// set up the sub-tasks
return parentTask.newListr(subTasks, {
Expand Down Expand Up @@ -316,13 +316,13 @@ export class NetworkCommand extends BaseCommand {
const config = /** @type {NetworkDeployConfigClass} **/ ctx.config

// nodes
for (const nodeId of config.nodeIds) {
for (const nodeAlias of config.nodeAliases) {
subTasks.push({
title: `Check Node: ${chalk.yellow(nodeId)}`,
title: `Check Node: ${chalk.yellow(nodeAlias)}`,
task: async () =>
await self.k8.waitForPods([constants.POD_PHASE_RUNNING], [
'fullstack.hedera.com/type=network-node',
`fullstack.hedera.com/node-name=${nodeId}`
`fullstack.hedera.com/node-name=${nodeAlias}`
], 1, 60 * 15, 1000) // timeout 15 minutes
})
}
Expand All @@ -344,9 +344,9 @@ export class NetworkCommand extends BaseCommand {
const config = /** @type {NetworkDeployConfigClass} **/ ctx.config

// HAProxy
for (const nodeId of config.nodeIds) {
for (const nodeAlias of config.nodeAliases) {
subTasks.push({
title: `Check HAProxy for: ${chalk.yellow(nodeId)}`,
title: `Check HAProxy for: ${chalk.yellow(nodeAlias)}`,
task: async () =>
await self.k8.waitForPods([constants.POD_PHASE_RUNNING], [
'fullstack.hedera.com/type=haproxy'
Expand All @@ -355,9 +355,9 @@ export class NetworkCommand extends BaseCommand {
}

// Envoy Proxy
for (const nodeId of config.nodeIds) {
for (const nodeAlias of config.nodeAliases) {
subTasks.push({
title: `Check Envoy Proxy for: ${chalk.yellow(nodeId)}`,
title: `Check Envoy Proxy for: ${chalk.yellow(nodeAlias)}`,
task: async () =>
await self.k8.waitForPods([constants.POD_PHASE_RUNNING], [
'fullstack.hedera.com/type=envoy-proxy'
Expand Down
Loading

0 comments on commit 70cfbad

Please sign in to comment.