Enabled SQL MIAA deployment in direct mode (#17874)

* Added customlocation, location, resource group, and connection mode to controllerinfo. Updated SQL MIAA create notebook with direct mode params.

* Removed annotations from metadata in postgres test file.

* Only parse the customlocation if the connection mode is direct.

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2021-12-09 12:14:31 -08:00
committed by GitHub
parent 46fc807b69
commit 0ec2974aa4
7 changed files with 53 additions and 5 deletions

View File

@@ -32,6 +32,10 @@ export class ArcControllersOptionsSourceProvider implements rd.IOptionsSourcePro
case 'namespace': return controller.info.namespace || '';
case 'kubeConfig': return controller.info.kubeConfigFilePath;
case 'clusterContext': return controller.info.kubeClusterContext;
case 'resourceGroup': return controller.info.resourceGroup;
case 'connectionMode': return controller.info.connectionMode;
case 'location': return controller.info.location;
case 'customLocation': return controller.info.customLocation;
default: throw new Error(loc.variableValueFetchForUnsupportedVariable(variableName));
}
}
@@ -41,6 +45,10 @@ export class ArcControllersOptionsSourceProvider implements rd.IOptionsSourcePro
case 'namespace': return false;
case 'kubeConfig': return false;
case 'clusterContext': return false;
case 'resourceGroup': return false;
case 'connectionMode': return false;
case 'location': return false;
case 'customLocation': return false;
default: throw new Error(loc.isPasswordFetchForUnsupportedVariable(variableName));
}
}

View File

@@ -11,7 +11,7 @@ import { AzureArcTreeDataProvider } from '../../ui/tree/azureArcTreeDataProvider
export class FakeControllerModel extends ControllerModel {
constructor(treeDataProvider?: AzureArcTreeDataProvider, info?: Partial<ControllerInfo>) {
const _info: ControllerInfo = Object.assign({ id: uuid(), endpoint: '', kubeConfigFilePath: '', kubeClusterContext: '', name: '', namespace: '', username: '', rememberPassword: false, resources: [] }, info);
const _info: ControllerInfo = Object.assign({ id: uuid(), endpoint: '', kubeConfigFilePath: '', kubeClusterContext: '', name: '', namespace: '', username: '', rememberPassword: false, resources: [], resourceGroup: '', connectionMode: '', location: '', customLocation: '' }, info);
super(treeDataProvider!, _info);
}

View File

@@ -39,7 +39,11 @@ declare module 'arc' {
kubeClusterContext: string,
namespace: string,
name: string,
resources: ResourceInfo[]
resources: ResourceInfo[],
resourceGroup: string,
connectionMode: string,
location: string,
customLocation: string
};
export interface DataController {

View File

@@ -93,6 +93,10 @@ abstract class ControllerDialogBase extends InitializingComponent {
protected completionPromise = new Deferred<ConnectToControllerDialogModel | undefined>();
protected id!: string;
protected resources: ResourceInfo[] = [];
protected resourceGroup!: string;
protected connectionMode!: string;
protected location!: string;
protected customLocation!: string;
constructor(protected treeDataProvider: AzureArcTreeDataProvider, title: string) {
super();
@@ -165,7 +169,11 @@ abstract class ControllerDialogBase extends InitializingComponent {
kubeConfigFilePath: this.kubeConfigInputBox.value!,
kubeClusterContext: this.clusterContextRadioGroup.value!,
name: this.nameInputBox.value ?? '',
resources: this.resources
resources: this.resources,
resourceGroup: this.resourceGroup ?? '',
connectionMode: this.connectionMode ?? '',
location: this.location ?? '',
customLocation: this.customLocation ?? ''
};
}
}
@@ -191,6 +199,15 @@ export class ConnectToControllerDialog extends ControllerDialogBase {
await controllerModel.refresh(false, this.namespaceInputBox.value);
// default info.name to the name of the controller instance if the user did not specify their own and to a pre-canned default if for some weird reason controller endpoint returned instanceName is also not a valid value
controllerModel.info.name = controllerModel.info.name || controllerModel.controllerConfig?.metadata.name || loc.defaultControllerName;
controllerModel.info.resourceGroup = <string>controllerModel.controllerConfig?.spec.settings.azure.resourceGroup;
controllerModel.info.connectionMode = <string>controllerModel.controllerConfig?.spec.settings.azure.connectionMode;
controllerModel.info.location = <string>controllerModel.controllerConfig?.spec.settings.azure.location;
if (controllerModel.info.connectionMode === 'direct') {
const rawCustomLocation = <string>controllerModel.controllerConfig?.metadata.annotations['management.azure.com/customLocation'];
const exp = /\/\bsubscriptions\b\/[\S]*\/\bresourceGroups\/[\S]*\/providers\/[\S]*\/customLocations\/([\S]*)/;
controllerModel.info.customLocation = <string>exp.exec(rawCustomLocation)?.pop();
}
} catch (err) {
this.dialog.message = {
text: loc.connectToControllerFailed(this.namespaceInputBox.value, err),