mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
deploy BDC wizard improvement for CU1 (#7756)
* unified admin user account (#7485) * azdata changes * spaces * error message * comments * support AD authentication for bdc deployment (#7518) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * AD changes and review feedback (#7618) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * address comments from scenario review (#7546) * support AD authentication for bdc deployment (#7518) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * scenario review feedbacks * more fixes * adjust the display order of resource types * different way to implement left side buttons * revert unwanted changes * rename variable * more fixes for the scenario review feedback (#7589) * fix more issues * add help links * model view readonly text with links * fix size string * address comments * update notebooks * text update * address the feedback of 2nd round of deploy BDC wizard review (#7646) * 2nd review meeting comments * fix the unit test failure * recent changes in azdata * notebook background execution with azdata (#7741) * notebook background execution with azdata * prompt to open notebook in case of failure * fix path quote issue * better temp file handling * expose docker settings (#7751) * add docker settings * new icon for container image
This commit is contained in:
@@ -5,23 +5,42 @@
|
||||
import * as path from 'path';
|
||||
import { IPlatformService } from './platformService';
|
||||
import { BigDataClusterDeploymentProfile } from './bigDataClusterDeploymentProfile';
|
||||
import { BdcDeploymentType } from '../interfaces';
|
||||
|
||||
interface BdcConfigListOutput {
|
||||
stdout: string[];
|
||||
result: string[];
|
||||
}
|
||||
|
||||
export interface BdcEndpoint {
|
||||
endpoint: string;
|
||||
name: 'sql-server-master';
|
||||
}
|
||||
|
||||
export interface IAzdataService {
|
||||
getDeploymentProfiles(): Promise<BigDataClusterDeploymentProfile[]>;
|
||||
getDeploymentProfiles(deploymentType: BdcDeploymentType): Promise<BigDataClusterDeploymentProfile[]>;
|
||||
getEndpoints(clusterName: string, userName: string, password: string): Promise<BdcEndpoint[]>;
|
||||
}
|
||||
|
||||
export class AzdataService implements IAzdataService {
|
||||
constructor(private platformService: IPlatformService) {
|
||||
}
|
||||
|
||||
public async getDeploymentProfiles(): Promise<BigDataClusterDeploymentProfile[]> {
|
||||
public async getDeploymentProfiles(deploymentType: BdcDeploymentType): Promise<BigDataClusterDeploymentProfile[]> {
|
||||
let profilePrefix: string;
|
||||
switch (deploymentType) {
|
||||
case BdcDeploymentType.NewAKS:
|
||||
case BdcDeploymentType.ExistingAKS:
|
||||
profilePrefix = 'aks';
|
||||
break;
|
||||
case BdcDeploymentType.ExistingKubeAdm:
|
||||
profilePrefix = 'kubeadm';
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown deployment type: ${deploymentType}`);
|
||||
}
|
||||
await this.ensureWorkingDirectoryExists();
|
||||
const profileNames = await this.getDeploymentProfileNames();
|
||||
return await Promise.all(profileNames.map(profile => this.getDeploymentProfileInfo(profile)));
|
||||
return await Promise.all(profileNames.filter(profile => profile.startsWith(profilePrefix)).map(profile => this.getDeploymentProfileInfo(profile)));
|
||||
}
|
||||
|
||||
private async getDeploymentProfileNames(): Promise<string[]> {
|
||||
@@ -29,17 +48,16 @@ export class AzdataService implements IAzdataService {
|
||||
// azdata requires this environment variables to be set
|
||||
env['ACCEPT_EULA'] = 'yes';
|
||||
const cmd = 'azdata bdc config list -o json';
|
||||
// Run the command twice to workaround the issue:
|
||||
// First time use of the azdata will have extra EULA related string in the output
|
||||
// there is no easy and reliable way to filter out the profile names from it.
|
||||
await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
|
||||
const stdout = await this.platformService.runCommand(cmd);
|
||||
const stdout = await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
|
||||
const output = <BdcConfigListOutput>JSON.parse(stdout);
|
||||
return output.stdout;
|
||||
return output.result;
|
||||
}
|
||||
|
||||
private async getDeploymentProfileInfo(profileName: string): Promise<BigDataClusterDeploymentProfile> {
|
||||
await this.platformService.runCommand(`azdata bdc config init --source ${profileName} --target ${profileName} --force`, { workingDirectory: this.platformService.storagePath() });
|
||||
const env: NodeJS.ProcessEnv = {};
|
||||
// azdata requires this environment variables to be set
|
||||
env['ACCEPT_EULA'] = 'yes';
|
||||
await this.platformService.runCommand(`azdata bdc config init --source ${profileName} --target ${profileName} --force`, { workingDirectory: this.platformService.storagePath(), additionalEnvironmentVariables: env });
|
||||
const configObjects = await Promise.all([
|
||||
this.getJsonObjectFromFile(path.join(this.platformService.storagePath(), profileName, 'bdc.json')),
|
||||
this.getJsonObjectFromFile(path.join(this.platformService.storagePath(), profileName, 'control.json'))
|
||||
@@ -56,4 +74,16 @@ export class AzdataService implements IAzdataService {
|
||||
private async getJsonObjectFromFile(path: string): Promise<any> {
|
||||
return JSON.parse(await this.platformService.readTextFile(path));
|
||||
}
|
||||
|
||||
public async getEndpoints(clusterName: string, userName: string, password: string): Promise<BdcEndpoint[]> {
|
||||
const env: NodeJS.ProcessEnv = {};
|
||||
env['AZDATA_USERNAME'] = userName;
|
||||
env['AZDATA_PASSWORD'] = password;
|
||||
env['ACCEPT_EULA'] = 'yes';
|
||||
let cmd = 'azdata login -n ' + clusterName;
|
||||
await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
|
||||
cmd = 'azdata bdc endpoint list';
|
||||
const stdout = await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
|
||||
return <BdcEndpoint[]>JSON.parse(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user