Skip to content

Commit

Permalink
fix: fullstack cluster setup is not uninstalling correctly (#742)
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 Feb 7, 2024
1 parent 911d25b commit 56402e0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions solo/src/commands/cluster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export class ClusterCommand extends BaseCommand {

/**
* Show list of installed chart
* @param namespace
* @param clusterSetupNamespace
*/
async showInstalledChartList (namespace) {
this.logger.showList('Installed Charts', await this.chartManager.getInstalledCharts(namespace))
async showInstalledChartList (clusterSetupNamespace) {
this.logger.showList('Installed Charts', await this.chartManager.getInstalledCharts(clusterSetupNamespace))
}

/**
Expand Down Expand Up @@ -113,19 +113,19 @@ export class ClusterCommand extends BaseCommand {
{
title: `Install '${constants.FULLSTACK_CLUSTER_SETUP_CHART}' chart`,
task: async (ctx, _) => {
const namespace = ctx.config.clusterSetupNamespace
const clusterSetupNamespace = ctx.config.clusterSetupNamespace
const version = ctx.config.fstChartVersion

const chartPath = ctx.chartPath
const valuesArg = ctx.valuesArg

try {
await self.chartManager.install(namespace, constants.FULLSTACK_CLUSTER_SETUP_CHART, chartPath, version, valuesArg)
await self.chartManager.install(clusterSetupNamespace, constants.FULLSTACK_CLUSTER_SETUP_CHART, chartPath, version, valuesArg)
} catch (e) {
// if error, uninstall the chart and rethrow the error
self.logger.debug(`Error on installing ${constants.FULLSTACK_CLUSTER_SETUP_CHART}. attempting to rollback by uninstalling the chart`, e)
try {
await self.chartManager.uninstall(namespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
await self.chartManager.uninstall(clusterSetupNamespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
} catch (ex) {
// ignore error during uninstall since we are doing the best-effort uninstall here
}
Expand All @@ -134,7 +134,7 @@ export class ClusterCommand extends BaseCommand {
}

if (argv.dev) {
await self.showInstalledChartList(namespace)
await self.showInstalledChartList(clusterSetupNamespace)
}
},
skip: (ctx, _) => ctx.isChartInstalled
Expand Down Expand Up @@ -177,22 +177,22 @@ export class ClusterCommand extends BaseCommand {

self.configManager.load(argv)
const clusterName = self.configManager.getFlag(flags.clusterName)
const namespace = self.configManager.getFlag(flags.clusterSetupNamespace)
const clusterSetupNamespace = self.configManager.getFlag(flags.clusterSetupNamespace)
ctx.config = {
clusterName,
namespace
clusterSetupNamespace
}

ctx.isChartInstalled = await this.chartManager.isChartInstalled(ctx.config.namespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
ctx.isChartInstalled = await this.chartManager.isChartInstalled(ctx.config.clusterSetupNamespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
}
},
{
title: `Uninstall '${constants.FULLSTACK_CLUSTER_SETUP_CHART}' chart`,
task: async (ctx, _) => {
const namespace = ctx.config.clusterSetupNamespace
await self.chartManager.uninstall(namespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
const clusterSetupNamespace = ctx.config.clusterSetupNamespace
await self.chartManager.uninstall(clusterSetupNamespace, constants.FULLSTACK_CLUSTER_SETUP_CHART)
if (argv.dev) {
await self.showInstalledChartList(namespace)
await self.showInstalledChartList(clusterSetupNamespace)
}
},
skip: (ctx, _) => !ctx.isChartInstalled
Expand Down

0 comments on commit 56402e0

Please sign in to comment.