Skip to content

Commit 8411ff3

Browse files
chore: add kubeContext parameter (#1365)
Signed-off-by: Jeromy Cannon <[email protected]> Co-authored-by: Jeromy Cannon <[email protected]>
1 parent 369065e commit 8411ff3

12 files changed

+135
-175
lines changed

package-lock.json

Lines changed: 0 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"eslint-plugin-promise": "^7.2.1",
116116
"eslint-plugin-tsdoc": "^0.4.0",
117117
"globals": "^15.14.0",
118-
"jest-mock": "^29.7.0",
119118
"jsdoc": "^4.0.4",
120119
"madge": "^8.0.0",
121120
"mocha": "^11.1.0",

src/commands/cluster/tasks.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,28 @@ export class ClusterCommandTasks {
450450
parent.logger.debug(`Installing chart chartPath = ${ctx.chartPath}, version = ${version}`);
451451
await parent
452452
.getChartManager()
453-
.install(clusterSetupNamespace, constants.SOLO_CLUSTER_SETUP_CHART, ctx.chartPath, version, valuesArg);
453+
.install(
454+
clusterSetupNamespace,
455+
constants.SOLO_CLUSTER_SETUP_CHART,
456+
ctx.chartPath,
457+
version,
458+
valuesArg,
459+
this.k8Factory.default().contexts().readCurrent(),
460+
);
454461
} catch (e: Error | unknown) {
455462
// if error, uninstall the chart and rethrow the error
456463
parent.logger.debug(
457464
`Error on installing ${constants.SOLO_CLUSTER_SETUP_CHART}. attempting to rollback by uninstalling the chart`,
458465
e,
459466
);
460467
try {
461-
await parent.getChartManager().uninstall(clusterSetupNamespace, constants.SOLO_CLUSTER_SETUP_CHART);
468+
await parent
469+
.getChartManager()
470+
.uninstall(
471+
clusterSetupNamespace,
472+
constants.SOLO_CLUSTER_SETUP_CHART,
473+
this.k8Factory.default().contexts().readCurrent(),
474+
);
462475
} catch {
463476
// ignore error during uninstall since we are doing the best-effort uninstall here
464477
}
@@ -504,8 +517,13 @@ export class ClusterCommandTasks {
504517
process.exit(0);
505518
}
506519
}
507-
508-
await parent.getChartManager().uninstall(clusterSetupNamespace, constants.SOLO_CLUSTER_SETUP_CHART);
520+
await parent
521+
.getChartManager()
522+
.uninstall(
523+
clusterSetupNamespace,
524+
constants.SOLO_CLUSTER_SETUP_CHART,
525+
this.k8Factory.default().contexts().readCurrent(),
526+
);
509527
if (argv.dev) {
510528
await this.showInstalledChartList(clusterSetupNamespace);
511529
}

src/commands/explorer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export class ExplorerCommand extends BaseCommand {
222222
chartPath,
223223
soloChartVersion,
224224
' --set cloud.certManager.enabled=true --set cert-manager.installCRDs=true',
225+
this.k8Factory.default().contexts().readCurrent(),
225226
);
226227
}
227228

@@ -248,6 +249,7 @@ export class ExplorerCommand extends BaseCommand {
248249
chartPath,
249250
soloChartVersion,
250251
soloChartSetupValuesArg,
252+
this.k8Factory.default().contexts().readCurrent(),
251253
);
252254

253255
if (config.enableIngress) {
@@ -287,6 +289,7 @@ export class ExplorerCommand extends BaseCommand {
287289
constants.HEDERA_EXPLORER_CHART_URL,
288290
config.hederaExplorerVersion,
289291
exploreValuesArg,
292+
this.k8Factory.default().contexts().readCurrent(),
290293
);
291294

292295
// patch explorer ingress to use h1 protocol, haproxy ingress controller default backend protocol is h2
@@ -407,7 +410,11 @@ export class ExplorerCommand extends BaseCommand {
407410
{
408411
title: 'Destroy explorer',
409412
task: async ctx => {
410-
await this.chartManager.uninstall(ctx.config.namespace, constants.HEDERA_EXPLORER_RELEASE_NAME);
413+
await this.chartManager.uninstall(
414+
ctx.config.namespace,
415+
constants.HEDERA_EXPLORER_RELEASE_NAME,
416+
this.k8Factory.default().contexts().readCurrent(),
417+
);
411418
},
412419
skip: ctx => !ctx.config.isChartInstalled,
413420
},

src/commands/mirror_node.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export class MirrorNodeCommand extends BaseCommand {
351351
ctx.config.chartPath,
352352
ctx.config.mirrorNodeVersion,
353353
ctx.config.valuesArg,
354+
this.k8Factory.default().contexts().readCurrent(),
354355
);
355356
},
356357
},
@@ -620,7 +621,11 @@ export class MirrorNodeCommand extends BaseCommand {
620621
{
621622
title: 'Destroy mirror-node',
622623
task: async ctx => {
623-
await this.chartManager.uninstall(ctx.config.namespace, constants.MIRROR_NODE_RELEASE_NAME);
624+
await this.chartManager.uninstall(
625+
ctx.config.namespace,
626+
constants.MIRROR_NODE_RELEASE_NAME,
627+
this.k8Factory.default().contexts().readCurrent(),
628+
);
624629
},
625630
skip: ctx => !ctx.config.isChartInstalled,
626631
},

src/commands/network.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@ export class NetworkCommand extends BaseCommand {
457457
async destroyTask(ctx: any, task: any) {
458458
const self = this;
459459
task.title = `Uninstalling chart ${constants.SOLO_DEPLOYMENT_CHART}`;
460-
await self.chartManager.uninstall(ctx.config.namespace, constants.SOLO_DEPLOYMENT_CHART);
460+
await self.chartManager.uninstall(
461+
ctx.config.namespace,
462+
constants.SOLO_DEPLOYMENT_CHART,
463+
this.k8Factory.default().contexts().readCurrent(),
464+
);
461465

462466
if (ctx.config.deletePvcs) {
463467
const pvcs = await self.k8Factory.default().pvcs().list(ctx.config.namespace, []);
@@ -573,7 +577,11 @@ export class NetworkCommand extends BaseCommand {
573577
task: async ctx => {
574578
const config = ctx.config;
575579
if (await self.chartManager.isChartInstalled(config.namespace, constants.SOLO_DEPLOYMENT_CHART)) {
576-
await self.chartManager.uninstall(config.namespace, constants.SOLO_DEPLOYMENT_CHART);
580+
await self.chartManager.uninstall(
581+
config.namespace,
582+
constants.SOLO_DEPLOYMENT_CHART,
583+
this.k8Factory.default().contexts().readCurrent(),
584+
);
577585
}
578586

579587
await this.chartManager.install(
@@ -582,6 +590,7 @@ export class NetworkCommand extends BaseCommand {
582590
ctx.config.chartPath,
583591
config.soloChartVersion,
584592
config.valuesArg,
593+
this.k8Factory.default().contexts().readCurrent(),
585594
);
586595
},
587596
},
@@ -840,6 +849,7 @@ export class NetworkCommand extends BaseCommand {
840849
ctx.config.chartPath,
841850
config.soloChartVersion,
842851
config.valuesArg,
852+
this.k8Factory.default().contexts().readCurrent(),
843853
);
844854
},
845855
},

src/commands/node/tasks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ export class NodeCommandTasks {
15771577
ctx.config.chartPath,
15781578
config.soloChartVersion,
15791579
valuesArg,
1580+
this.k8Factory.default().contexts().readCurrent(),
15801581
);
15811582
},
15821583
skip,

src/commands/relay.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export class RelayCommand extends BaseCommand {
267267
config.chartPath,
268268
'',
269269
config.valuesArg,
270+
this.k8Factory.default().contexts().readCurrent(),
270271
);
271272

272273
await self.k8Factory
@@ -376,7 +377,11 @@ export class RelayCommand extends BaseCommand {
376377
task: async ctx => {
377378
const config = ctx.config;
378379

379-
await this.chartManager.uninstall(config.namespace, config.releaseName);
380+
await this.chartManager.uninstall(
381+
config.namespace,
382+
config.releaseName,
383+
this.k8Factory.default().contexts().readCurrent(),
384+
);
380385

381386
this.logger.showList('Destroyed Relays', await self.chartManager.getInstalledCharts(config.namespace));
382387

0 commit comments

Comments
 (0)