mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Add Storage Class params to MIAA deploy (#11993)
This commit is contained in:
@@ -37,7 +37,7 @@ export class AzdataTool extends ToolBase {
|
||||
}
|
||||
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.AzdataDisplayName', "azdata");
|
||||
return localize('resourceDeployment.AzdataDisplayName', "Azure Data CLI");
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
|
||||
@@ -20,6 +20,27 @@ interface KubeCtlVersion {
|
||||
};
|
||||
}
|
||||
|
||||
export interface KubeStorageClass {
|
||||
apiVersion: string, // "storage.k8s.io/v1",
|
||||
kind: string, // "StorageClass",
|
||||
metadata: KubeStorageClassMetadata,
|
||||
provisioner: string, // "kubernetes.io/no-provisioner",
|
||||
reclaimPolicy: string, // "Delete",
|
||||
volumeBindingMode: string, // "WaitForFirstConsumer"
|
||||
}
|
||||
|
||||
export interface KubeStorageClassMetadata {
|
||||
annotations: {
|
||||
'kubectl.kubernetes.io/last-applied-configuration': string, // "{\"apiVersion\":\"storage.k8s.io/v1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{},\"name\":\"local-storage\"},\"provisioner\":\"kubernetes.io/no-provisioner\",\"reclaimPolicy\":\"Delete\",\"volumeBindingMode\":\"WaitForFirstConsumer\"}\n",
|
||||
'storageclass.kubernetes.io/is-default-class': string, // "true"
|
||||
},
|
||||
creationTimestamp: string, // "2020-08-17T19:55:23Z",
|
||||
name: string, // "local-storage",
|
||||
resourceVersion: string, // "256",
|
||||
selfLink: string, // "/apis/storage.k8s.io/v1/storageclasses/local-storage",
|
||||
uid: string, // "262615e9-618b-4052-b0d4-2ddd02794cb4"
|
||||
}
|
||||
|
||||
export class KubeCtlTool extends ToolBase {
|
||||
constructor(platformService: IPlatformService) {
|
||||
super(platformService);
|
||||
@@ -45,6 +66,14 @@ export class KubeCtlTool extends ToolBase {
|
||||
return 'https://kubernetes.io/docs/tasks/tools/install-kubectl';
|
||||
}
|
||||
|
||||
public async getStorageClasses(): Promise<{ storageClasses: string[], defaultStorageClass: string }> {
|
||||
const storageClasses: KubeStorageClass[] = JSON.parse(await this.platformService.runCommand('kubectl get sc -o json')).items;
|
||||
return {
|
||||
storageClasses: storageClasses.map(sc => sc.metadata.name),
|
||||
defaultStorageClass: storageClasses.find(sc => sc.metadata.annotations['storageclass.kubernetes.io/is-default-class'] === 'true')?.metadata.name ?? ''
|
||||
};
|
||||
}
|
||||
|
||||
protected getVersionFromOutput(output: string): SemVer | undefined {
|
||||
let version: SemVer | undefined = undefined;
|
||||
if (output) {
|
||||
|
||||
@@ -40,7 +40,7 @@ export const messageByDependencyType: Map<dependencyType, string> = new Map<depe
|
||||
]);
|
||||
|
||||
export abstract class ToolBase implements ITool {
|
||||
constructor(private _platformService: IPlatformService) {
|
||||
constructor(protected platformService: IPlatformService) {
|
||||
this.startVersionAndStatusUpdate();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
protected logToOutputChannel(data: string | Buffer, header?: string): void {
|
||||
this._platformService.logToOutputChannel(data, header); // data and header are localized by caller
|
||||
this.platformService.logToOutputChannel(data, header); // data and header are localized by caller
|
||||
}
|
||||
|
||||
public get onDidUpdateData(): vscode.Event<ITool> {
|
||||
@@ -101,11 +101,11 @@ export abstract class ToolBase implements ITool {
|
||||
return this.status === ToolStatus.NotInstalled && this.autoInstallSupported;
|
||||
}
|
||||
public get storagePath(): string {
|
||||
return this._platformService.storagePath();
|
||||
return this.platformService.storagePath();
|
||||
}
|
||||
|
||||
public get osDistribution(): OsDistribution {
|
||||
return this._platformService.osDistribution();
|
||||
return this.platformService.osDistribution();
|
||||
}
|
||||
|
||||
protected get version(): SemVer | undefined {
|
||||
@@ -136,7 +136,7 @@ export abstract class ToolBase implements ITool {
|
||||
|
||||
protected async getPip3InstallLocation(packageName: string): Promise<string> {
|
||||
const command = `pip3 show ${packageName}`;
|
||||
const pip3ShowOutput: string = await this._platformService.runCommand(command, { sudo: false, ignoreError: true });
|
||||
const pip3ShowOutput: string = await this.platformService.runCommand(command, { sudo: false, ignoreError: true });
|
||||
const installLocation = /^Location\: (.*)$/gim.exec(pip3ShowOutput);
|
||||
let retValue = installLocation && installLocation[1];
|
||||
if (retValue === undefined || retValue === null) {
|
||||
@@ -150,11 +150,11 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
public get outputChannelName(): string {
|
||||
return this._platformService.outputChannelName();
|
||||
return this.platformService.outputChannelName();
|
||||
}
|
||||
|
||||
public showOutputChannel(preserveFocus?: boolean | undefined): void {
|
||||
this._platformService.showOutputChannel(preserveFocus);
|
||||
this.platformService.showOutputChannel(preserveFocus);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ export abstract class ToolBase implements ITool {
|
||||
throw new Error(localize('toolBase.installCore.CannotInstallTool', "Cannot install tool:{0}::{1} as installation commands are unknown for your OS distribution, Please install {0} manually before proceeding", this.displayName, this.description));
|
||||
}
|
||||
for (let i: number = 0; i < installationCommands.length; i++) {
|
||||
await this._platformService.runCommand(installationCommands[i].command,
|
||||
await this.platformService.runCommand(installationCommands[i].command,
|
||||
{
|
||||
workingDirectory: installationCommands[i].workingDirectory || this.downloadPath,
|
||||
additionalEnvironmentVariables: installationCommands[i].additionalEnvironmentVariables,
|
||||
@@ -253,7 +253,7 @@ export abstract class ToolBase implements ITool {
|
||||
private async updateVersionAndStatus(): Promise<void> {
|
||||
this._statusDescription = '';
|
||||
await this.addInstallationSearchPathsToSystemPath();
|
||||
const commandOutput = await this._platformService.runCommand(
|
||||
const commandOutput = await this.platformService.runCommand(
|
||||
this.versionCommand.command,
|
||||
{
|
||||
workingDirectory: this.versionCommand.workingDirectory,
|
||||
@@ -289,7 +289,7 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
protected async setInstallationPath() {
|
||||
const commandOutput = await this._platformService.runCommand(
|
||||
const commandOutput = await this.platformService.runCommand(
|
||||
this.discoveryCommand.command,
|
||||
{
|
||||
workingDirectory: this.discoveryCommand.workingDirectory,
|
||||
|
||||
Reference in New Issue
Block a user