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,6 +6,8 @@
|
||||
|
||||
import { IKubeConfigParser } from '../../data/kubeConfigParser';
|
||||
import { ClusterInfo, TargetClusterType, ClusterPorts, ContainerRegistryInfo, TargetClusterTypeInfo, ToolInfo } from '../../interfaces';
|
||||
import { getContexts, KubectlContext } from '../../kubectl/kubectlUtils';
|
||||
import { Kubectl } from '../../kubectl/kubectl';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
@@ -14,11 +16,11 @@ export class CreateClusterModel {
|
||||
|
||||
private _tmp_tools_installed: boolean = false;
|
||||
|
||||
constructor(private _kubeConfigParser: IKubeConfigParser) {
|
||||
constructor(private _kubectl : Kubectl) {
|
||||
}
|
||||
|
||||
public loadClusters(configPath: string): ClusterInfo[] {
|
||||
return this._kubeConfigParser.parse(configPath);
|
||||
public async loadClusters(): Promise<KubectlContext[]> {
|
||||
return await getContexts(this._kubectl);
|
||||
}
|
||||
|
||||
public getDefaultPorts(): Thenable<ClusterPorts> {
|
||||
@@ -107,7 +109,7 @@ export class CreateClusterModel {
|
||||
|
||||
public targetClusterType: TargetClusterType;
|
||||
|
||||
public selectedCluster: ClusterInfo;
|
||||
public selectedCluster: KubectlContext;
|
||||
|
||||
public adminUserName: string;
|
||||
|
||||
|
||||
@@ -9,18 +9,17 @@ import { SelectExistingClusterPage } from './pages/selectExistingClusterPage';
|
||||
import { SummaryPage } from './pages/summaryPage';
|
||||
import { SettingsPage } from './pages/settingsPage';
|
||||
import { ClusterProfilePage } from './pages/clusterProfilePage';
|
||||
import { TestKubeConfigParser } from '../../data/kubeConfigParser';
|
||||
import { ExtensionContext } from 'vscode';
|
||||
import { WizardBase } from '../wizardBase';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Kubectl } from '../../kubectl/kubectl';
|
||||
import { SelectTargetClusterTypePage } from './pages/selectTargetClusterTypePage';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class CreateClusterWizard extends WizardBase<CreateClusterModel, CreateClusterWizard> {
|
||||
constructor(context: ExtensionContext) {
|
||||
let configParser = new TestKubeConfigParser();
|
||||
let model = new CreateClusterModel(configParser);
|
||||
constructor(context: ExtensionContext, kubectl: Kubectl) {
|
||||
let model = new CreateClusterModel(kubectl);
|
||||
super(model, context, localize('bdc-create.wizardTitle', 'Create a big data cluster'));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import * as os from 'os';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { CreateClusterWizard } from '../createClusterWizard';
|
||||
import { TargetClusterType } from '../../../interfaces';
|
||||
import { setActiveKubeconfig } from '../../../config/config';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
@@ -101,7 +103,7 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
|
||||
defaultUri: vscode.Uri.file(os.homedir()),
|
||||
openLabel: localize('bdc-selectKubeConfigFileText', 'Select'),
|
||||
filters: {
|
||||
'KubeConfig Files': ['kubeconfig'],
|
||||
'KubeConfig Files': ['*'],
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -114,8 +116,9 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
|
||||
let fileUri = fileUris[0];
|
||||
|
||||
configFileInput.value = fileUri.fsPath;
|
||||
await setActiveKubeconfig(fileUri.fsPath);
|
||||
|
||||
let clusters = self.wizard.model.loadClusters(fileUri.fsPath);
|
||||
let clusters = await self.wizard.model.loadClusters();
|
||||
|
||||
self.cards = [];
|
||||
if (clusters.length !== 0) {
|
||||
@@ -124,8 +127,8 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
|
||||
let cluster = clusters[i];
|
||||
let card = view.modelBuilder.card().withProperties({
|
||||
selected: i === 0,
|
||||
label: cluster.name,
|
||||
descriptions: [cluster.displayName, cluster.user],
|
||||
label: cluster.clusterName,
|
||||
descriptions: [cluster.clusterName, cluster.userName],
|
||||
cardType: sqlops.CardType.ListItem,
|
||||
iconPath: {
|
||||
dark: self.wizard.context.asAbsolutePath('images/cluster_inverse.svg'),
|
||||
|
||||
Reference in New Issue
Block a user