-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Show Helm releases in the project explorer using results from `helm list` - Add description text for items in the application explorer to help distinguish them - Refactor Helm commands into their own folder - Add integration tests for Helm commands Fixes #3021 Signed-off-by: David Thompson <davthomp@redhat.com>
- Loading branch information
Showing
10 changed files
with
199 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
"base": "$tsc-watch", | ||
}, | ||
"presentation": { | ||
"reveal": "silent", | ||
"reveal": "never", | ||
}, | ||
}, | ||
{ | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*----------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
*-----------------------------------------------------------------------------------------------*/ | ||
import { CliChannel, CliExitData } from '../cli'; | ||
import * as HelmCommands from './helmCommands'; | ||
|
||
export type HelmRelease = { | ||
name: string; | ||
namespace: string; | ||
revision: string; | ||
updated: string; | ||
status: string; | ||
chart: string; | ||
app_version: string; | ||
}; | ||
|
||
/** | ||
* Returns a list of all Helm releases in the current namespace on the current cluster. | ||
* | ||
* @returns a list of all Helm releases in the current namespace on the current cluster | ||
*/ | ||
export async function getHelmReleases(): Promise<HelmRelease[]> { | ||
const res = await CliChannel.getInstance().executeTool(HelmCommands.listHelmReleases()); | ||
return JSON.parse(res.stdout) as HelmRelease[]; | ||
} | ||
|
||
/** | ||
* Adds the OpenShift Helm repo to the cluster. | ||
* | ||
* @returns the CLI output data from running the necessary command | ||
*/ | ||
export async function addHelmRepo(): Promise<CliExitData> { | ||
return await CliChannel.getInstance().executeTool(HelmCommands.addHelmRepo()); | ||
} | ||
|
||
/** | ||
* Updates the content of all the Helm repos. | ||
* | ||
* @returns the CLI output data from running the necessary command | ||
*/ | ||
export async function updateHelmRepo(): Promise<CliExitData> { | ||
return await CliChannel.getInstance().executeTool(HelmCommands.updateHelmRepo()); | ||
} | ||
|
||
/** | ||
* Install a chart from the OpenShift Helm Repo | ||
* | ||
* @param name the name of the release | ||
* @param chartName the name of the chart to install | ||
* @param version the version of the chart to use for the release | ||
* @returns the CLI output data from running the necessary command | ||
*/ | ||
export async function installHelmChart( | ||
name: string, | ||
chartName: string, | ||
version: string, | ||
): Promise<CliExitData> { | ||
return await CliChannel.getInstance().executeTool( | ||
HelmCommands.installHelmChart(name, chartName, version), | ||
); | ||
} | ||
|
||
/** | ||
* Uninstalls the given Helm release from the cluster. | ||
* | ||
* @param name the name of the Helm release to uninstall | ||
* @returns the CLI output data from running the necessary command | ||
*/ | ||
export async function unInstallHelmChart(name: string): Promise<CliExitData> { | ||
return await CliChannel.getInstance().executeTool(HelmCommands.unInstallHelmChart(name)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*----------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
*-----------------------------------------------------------------------------------------------*/ | ||
|
||
import { CommandOption, CommandText } from '../base/command'; | ||
|
||
export function addHelmRepo(): CommandText { | ||
return new CommandText('helm repo add openshift https://charts.openshift.io/'); | ||
} | ||
|
||
export function updateHelmRepo(): CommandText { | ||
return new CommandText('helm repo update'); | ||
} | ||
|
||
export function installHelmChart(name: string, chartName: string, version: string): CommandText { | ||
return new CommandText('helm', `install ${name} openshift/${chartName}`, [new CommandOption('--version', version)]); | ||
} | ||
|
||
export function unInstallHelmChart(name: string): CommandText { | ||
return new CommandText(`helm uninstall ${name}`); | ||
} | ||
|
||
export function listHelmReleases(): CommandText { | ||
return new CommandText('helm', 'list', [new CommandOption('-o', 'json')]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.