Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check if setup chart installed or not before network deploy #799

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@
return lease.buildAcquireTask(task)
}
},
{
title: 'Check if cluster setup chart is installed',
task: async (ctx, task) => {
const isChartInstalled = await this.chartManager.isChartInstalled('', constants.SOLO_CLUSTER_SETUP_CHART)
if (!isChartInstalled) {
throw new SoloError(`Chart ${constants.SOLO_CLUSTER_SETUP_CHART} is not installed. Run 'solo cluster setup'`)
}

Check warning on line 239 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L238-L239

Added lines #L238 - L239 were not covered by tests
}
},
{
title: 'Prepare staging directory',
task: (_, parentTask) => {
Expand Down Expand Up @@ -547,7 +556,7 @@
return yargs
.command({
command: 'deploy',
desc: 'Deploy solo network',
desc: "Deploy solo network. Requires the chart `solo-cluster-setup` to have been installed in the cluster. If it hasn't the following command can be ran: `solo cluster setup`",

Check warning on line 559 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L559

Added line #L559 was not covered by tests
builder: (y: any) => flags.setCommandFlags(y, ...NetworkCommand.DEPLOY_FLAGS_LIST),
handler: (argv: any) => {
networkCmd.logger.debug('==== Running \'network deploy\' ===')
Expand Down
3 changes: 3 additions & 0 deletions src/core/chart_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export class ChartManager {
/** List available clusters */
async getInstalledCharts (namespaceName: string) {
try {
if (!namespaceName) {
return await this.helm.list('--all-namespaces --no-headers | awk \'{print $1 " [" $9"]"}\'')
}
return await this.helm.list(`-n ${namespaceName}`, '--no-headers | awk \'{print $1 " [" $9"]"}\'')
} catch (e: Error | any) {
this.logger.showUserError(e)
Expand Down
Loading