Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Tang <[email protected]>
  • Loading branch information
JeffreyDallas committed Jan 14, 2025
1 parent 2c19987 commit e5aa20f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flow-task-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ jobs:

- name: Run Example Task File Test with type ${{ matrix.type }}
run: |
task default-with-mirror
task default
.github/workflows/script/solo_smoke_test.sh ${{ matrix.type }}
task clean
2 changes: 1 addition & 1 deletion .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function start_sdk_test ()


# if first parameter equals to ACCOUNT_INIT,
# then call solo account init before deploy relay node
# then call solo account init before deploy mirror and relay node
if [ "$1" == "ACCOUNT_INIT" ]; then
echo "Call solo account init"
npm run solo-test -- account init -n solo-e2e
Expand Down
13 changes: 10 additions & 3 deletions src/commands/mirror_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import type {Optional, SoloListrTask} from '../types/index.js';
import type {Namespace} from '../core/config/remote/types.js';
import * as Base64 from 'js-base64';

interface MirrorNodeDeployConfigClass {
chartDirectory: string;
Expand Down Expand Up @@ -263,12 +264,18 @@ export class MirrorNodeCommand extends BaseCommand {
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.nodes.0.nodeId=0';

ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.accountId=${constants.OPERATOR_ID}`;
const secrets = await self.k8.getSecretsByLabel([
`solo.hedera.com/account-id=${constants.OPERATOR_ID}`,
]);
if (secrets.length === 0) {
throw new SoloError(`No secret found for operator account id ${constants.OPERATOR_ID}`);
}
try {
const keys = await this.accountManager.getAccountKeys(constants.OPERATOR_ID);
const newOperatorKey = keys[0].toString();
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${newOperatorKey}`;
const operatorKeyFromK8 = Base64.decode(secrets[0].data.privateKey);
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${operatorKeyFromK8}`;
} catch (e: Error | any) {
throw new SoloError(`Failed to get operator key for mirror node monitor. ${e.message}`, e);
}
Expand Down
27 changes: 14 additions & 13 deletions src/commands/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {type Opts} from '../types/command_types.js';
import {ListrLease} from '../core/lease/listr_lease.js';
import {RelayComponent} from '../core/config/remote/components/relay_component.js';
import {ComponentType} from '../core/config/remote/enumerations.js';
import * as Base64 from 'js-base64';

export class RelayCommand extends BaseCommand {
private readonly profileManager: ProfileManager;
Expand Down Expand Up @@ -105,23 +106,23 @@ export class RelayCommand extends BaseCommand {
valuesArg += ` --set replicaCount=${replicaCount}`;
}

if (operatorID) {
valuesArg += ` --set config.OPERATOR_ID_MAIN=${operatorID}`;
} else {
if (operatorID === constants.OPERATOR_ID) {
this.logger.info(`Use default operator id ${constants.OPERATOR_ID}`);
} else {
this.logger.info(`Use operator id from command line flag ${operatorID}`);
}
valuesArg += ` --set config.OPERATOR_ID_MAIN=${operatorID}`;

if (operatorKey) {
valuesArg += ` --set config.OPERATOR_KEY_MAIN=${operatorKey}`;
const secrets = await this.k8.getSecretsByLabel([`solo.hedera.com/account-id=${constants.OPERATOR_ID}`]);
if (secrets.length === 0) {
throw new SoloError(`No secret found for operator account id ${constants.OPERATOR_ID}`);
}
const operatorKeyFromK8 = Base64.decode(secrets[0].data.privateKey);
valuesArg += ` --set config.OPERATOR_KEY_MAIN=${operatorKeyFromK8}`;
if (operatorKeyFromK8 === constants.OPERATOR_KEY) {
this.logger.info(`Use default operator key ${constants.OPERATOR_KEY}`);
} else {
//lookup the operator key from GENESIS ACCOUNT since it could have been changed
try {
const keys = await this.accountManager.getAccountKeys(constants.OPERATOR_ID);
const newOperatorKey = keys[0].toString();
valuesArg += ` --set config.OPERATOR_KEY_MAIN=${newOperatorKey}`;
} catch (e: Error | any) {
throw new SoloError(`Error getting operator key or relay node: ${e.message}`, e);
}
this.logger.info('Use operator key from k8s secret');
}

if (!nodeAliases) {
Expand Down

0 comments on commit e5aa20f

Please sign in to comment.