Skip to content

Commit 929fdaa

Browse files
committed
got further into node add
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent b9f6d10 commit 929fdaa

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
lines changed

src/commands/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
import paths from 'path';
6-
import path from 'path';
76
import {MissingArgumentError, SoloError} from '../core/errors.js';
87
import {ShellRunner} from '../core/shell_runner.js';
98
import {type LeaseManager} from '../core/lease/lease_manager.js';
@@ -18,6 +17,7 @@ import {type Opts} from '../types/command_types.js';
1817
import {type CommandFlag} from '../types/flag_types.js';
1918
import {type Lease} from '../core/lease/lease.js';
2019
import {Listr} from 'listr2';
20+
import path from 'path';
2121
import * as constants from '../core/constants.js';
2222
import fs from 'fs';
2323
import {Task} from '../core/task.js';

src/commands/node/configs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ export const addConfigBuilder = async function (argv, ctx, task, shouldLoadNodeC
225225
'stagingKeysDir',
226226
'treasuryKey',
227227
'namespace',
228+
'consensusNodes',
228229
]) as NodeAddConfigClass;
229230

230231
ctx.adminKey = argv[flags.adminKey.name]
@@ -259,6 +260,8 @@ export const addConfigBuilder = async function (argv, ctx, task, shouldLoadNodeC
259260

260261
config.serviceMap = await this.accountManager.getNodeServiceMap(config.namespace);
261262

263+
config.consensusNodes = this.parent.getConsensusNodes();
264+
262265
return config;
263266
};
264267

src/commands/node/handlers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ export class NodeCommandHandlers implements CommandHandlers {
143143
addPrepareTasks(argv: any, lease: Lease) {
144144
return [
145145
this.tasks.initialize(argv, addConfigBuilder.bind(this), lease),
146-
this.validateSingleNodeState({excludedStates: []}),
146+
// TODO instead of validating the state we need to do a remote config add component, and we will need to manually
147+
// the nodeAlias based on the next available node ID + 1
148+
// this.validateSingleNodeState({excludedStates: []}),
147149
this.tasks.checkPVCsEnabled(),
148150
this.tasks.identifyExistingNodes(),
149151
this.tasks.determineNewNodeAccountNumber(),

src/commands/node/node_add_config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {type PodRef} from '../../core/kube/resources/pod/pod_ref.js';
66
import {type NetworkNodeServices} from '../../core/network_node_services.js';
77
import {type PrivateKey} from '@hashgraph/sdk';
88
import {type NamespaceName} from '../../core/kube/resources/namespace/namespace_name.js';
9+
import {type ConsensusNode} from '../../core/model/consensus_node.js';
910

1011
export interface NodeAddConfigClass {
1112
app: string;
@@ -46,4 +47,5 @@ export interface NodeAddConfigClass {
4647
haproxyIps: string;
4748
envoyIps: string;
4849
getUnusedConfigs: () => string[];
50+
consensusNodes: ConsensusNode[];
4951
}

src/commands/node/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ export class NodeCommandTasks {
14881488
return new Task('Copy node keys to secrets', (ctx: any, task: ListrTaskWrapper<any, any, any>) => {
14891489
const subTasks = this.platformInstaller.copyNodeKeys(
14901490
ctx.config.stagingDir,
1491-
ctx.config.allNodeAliases,
1491+
ctx.config.consensusNodes,
14921492
ctx.config.contexts,
14931493
);
14941494

test/test_add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function testNodeAdd(
3333
): void {
3434
const suffix = localBuildPath.substring(0, 5);
3535
const namespace = NamespaceName.of(`node-add${suffix}`);
36-
const argv = getDefaultArgv();
36+
const argv = getDefaultArgv(namespace);
3737
argv[flags.nodeAliasesUnparsed.name] = 'node1,node2';
3838
argv[flags.stakeAmounts.name] = '1500,1';
3939
argv[flags.generateGossipKeys.name] = true;

test/test_util.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function getDefaultArgv(namespace?: NamespaceName) {
8080
argv[f.name] = f.definition.defaultValue;
8181
}
8282

83-
const currentDeployment = namespace;
83+
const currentDeployment = namespace.name;
8484
const cacheDir = getTestCacheDir();
8585
argv.cacheDir = cacheDir;
8686
argv[flags.cacheDir.name] = cacheDir;
@@ -228,13 +228,14 @@ export function e2eTestSuite(
228228
nodeCmdArg,
229229
accountCmdArg,
230230
);
231-
const namespace = bootstrapResp.namespace;
232-
const initCmd = bootstrapResp.cmd.initCmd;
233-
const k8Factory = bootstrapResp.opts.k8Factory;
234-
const clusterCmd = bootstrapResp.cmd.clusterCmd;
235-
const networkCmd = bootstrapResp.cmd.networkCmd;
236-
const nodeCmd = bootstrapResp.cmd.nodeCmd;
237-
const chartManager = bootstrapResp.opts.chartManager;
231+
const namespace: NamespaceName = bootstrapResp.namespace;
232+
const initCmd: InitCommand = bootstrapResp.cmd.initCmd;
233+
const k8Factory: K8Factory = bootstrapResp.opts.k8Factory;
234+
const clusterCmd: ClusterCommand = bootstrapResp.cmd.clusterCmd;
235+
const networkCmd: NetworkCommand = bootstrapResp.cmd.networkCmd;
236+
const nodeCmd: NodeCommand = bootstrapResp.cmd.nodeCmd;
237+
const chartManager: ChartManager = bootstrapResp.opts.chartManager;
238+
const deploymentCmd: DeploymentCommand = bootstrapResp.cmd.deploymentCmd;
238239

239240
describe(`E2E Test Suite for '${testName}'`, function () {
240241
this.bail(true); // stop on first failure, nothing else will matter if network doesn't come up correctly
@@ -273,6 +274,10 @@ export function e2eTestSuite(
273274
}
274275
}).timeout(Duration.ofMinutes(2).toMillis());
275276

277+
it('should succeed with deployment create', async () => {
278+
expect(await deploymentCmd.create(argv)).to.be.true;
279+
});
280+
276281
it('generate key files', async () => {
277282
expect(await nodeCmd.handlers.keys(argv)).to.be.true;
278283
expect(nodeCmd.getUnusedConfigs(NodeCommandConfigs.KEYS_CONFIGS_NAME)).to.deep.equal([

0 commit comments

Comments
 (0)