in src/commands/aksEraserTool/erasertool.ts [11:66]
export default async function aksEraserTool(_context: IActionContext, target: unknown): Promise<void> {
const kubectl = await k8s.extension.kubectl.v1;
const cloudExplorer = await k8s.extension.cloudExplorer.v1;
const clusterExplorer = await k8s.extension.clusterExplorer.v1;
const sessionProvider = await getReadySessionProvider();
if (failed(sessionProvider)) {
vscode.window.showErrorMessage(sessionProvider.error);
return;
}
if (!kubectl.available) {
vscode.window.showWarningMessage(`Kubectl is unavailable.`);
return;
}
if (!cloudExplorer.available) {
vscode.window.showWarningMessage(`Cloud explorer is unavailable.`);
return;
}
if (!clusterExplorer.available) {
vscode.window.showWarningMessage(`Cluster explorer is unavailable.`);
return;
}
const clusterInfo = await getKubernetesClusterInfo(sessionProvider.result, target, cloudExplorer, clusterExplorer);
if (failed(clusterInfo)) {
vscode.window.showErrorMessage(clusterInfo.error);
return;
}
const clusterName = clusterInfo.result.name;
const answer = await vscode.window.showInformationMessage(
`Do you want to deploy Eraser tool for cluster ${clusterName} to handle [Automatic Cleaning Image](https://eraser-dev.github.io/eraser/docs/quick-start#automatically-cleaning-images)?`,
"Yes",
"No",
);
if (answer === "Yes") {
const result = await longRunning(`Deploying Eraser on cluster ${clusterName}.`, async () => {
return await deployEraserAutomaticInstallationScenario(kubectl, clusterInfo.result.kubeconfigYaml);
});
if (failed(result)) {
vscode.window.showErrorMessage(result.error);
}
if (succeeded(result)) {
vscode.window.showInformationMessage(
`Eraser tool is successfully deployed into cluster ${clusterName}. \n Output: \n ${result.result.stdout}`,
);
}
}
}