mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Feature/mssql-big-data-cluster (#4107)
* Adding kubernetes installer. * Adding variety of kubectl support and integrating into the kubeconfig target cluster page. * Addressing PR comments, refactored utility file locations and added missing license headers.
This commit is contained in:
@@ -6,10 +6,22 @@
|
||||
|
||||
import vscode = require('vscode');
|
||||
import { MainController } from './mainController';
|
||||
|
||||
import { fs } from './utility/fs';
|
||||
|
||||
import { host } from './kubectl/host';
|
||||
import { sqlserverbigdataclusterchannel } from './kubectl/kubeChannel';
|
||||
import { shell, Shell } from './utility/shell';
|
||||
import { CheckPresentMessageMode, create as kubectlCreate } from './kubectl/kubectl';
|
||||
import { installKubectl } from './installer/installer';
|
||||
import { Errorable, failed } from './interfaces';
|
||||
|
||||
const kubectl = kubectlCreate(host, fs, shell, installDependencies);
|
||||
export let controller: MainController;
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
controller = new MainController(context);
|
||||
kubectl.checkPresent(CheckPresentMessageMode.Activation);
|
||||
controller = new MainController(context, kubectl);
|
||||
controller.activate();
|
||||
}
|
||||
|
||||
@@ -19,3 +31,28 @@ export function deactivate(): void {
|
||||
controller.deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
export async function installDependencies() {
|
||||
const gotKubectl = await kubectl.checkPresent(CheckPresentMessageMode.Silent);
|
||||
|
||||
|
||||
const installPromises = [
|
||||
installDependency("kubectl", gotKubectl, installKubectl),
|
||||
];
|
||||
|
||||
await Promise.all(installPromises);
|
||||
|
||||
sqlserverbigdataclusterchannel.showOutput("Done");
|
||||
}
|
||||
|
||||
async function installDependency(name: string, alreadyGot: boolean, installFunc: (shell: Shell) => Promise<Errorable<null>>): Promise<void> {
|
||||
if (alreadyGot) {
|
||||
sqlserverbigdataclusterchannel.showOutput(`Already got ${name}...`);
|
||||
} else {
|
||||
sqlserverbigdataclusterchannel.showOutput(`Installing ${name}...`);
|
||||
const result = await installFunc(shell);
|
||||
if (failed(result)) {
|
||||
sqlserverbigdataclusterchannel.showOutput(`Unable to install ${name}: ${result.error[0]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user