Canye/fix refresh (#19424)

* Bump version of arc and azcli to 1.3.0

* Fixed refresh to do dc config show and endpoint list first, then check the connectionmode

* Await calls to refresh indirect and direct

* Made sql mi-arc delete also handle direct mode. Made customlocation for sql mi create work again, regex problem.

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-05-19 18:22:33 -07:00
committed by GitHub
parent 3eedbf04df
commit 6188c218ee
18 changed files with 148 additions and 118 deletions

View File

@@ -15,6 +15,7 @@ import { AzureArcTreeDataProvider } from '../tree/azureArcTreeDataProvider';
import { RadioOptionsGroup } from '../components/radioOptionsGroup';
import { getCurrentClusterContext, getDefaultKubeConfigPath, getKubeConfigClusterContexts, KubeClusterContext } from '../../common/kubeUtils';
import { FilePicker } from '../components/filePicker';
import { ConnectionMode } from '../../constants';
export type ConnectToControllerDialogModel = { controllerModel: ControllerModel };
@@ -196,16 +197,16 @@ export class ConnectToControllerDialog extends ControllerDialogBase {
const controllerModel = new ControllerModel(this.treeDataProvider, controllerInfo);
try {
// Validate that we can connect to the controller, this also populates the controllerRegistration from the connection response.
await controllerModel.refresh(false, this.resourceGroup, this.namespaceInputBox.value);
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') {
if (controllerModel.info.connectionMode === ConnectionMode.direct) {
const rawCustomLocation = <string>controllerModel.controllerConfig?.metadata.annotations['management.azure.com/customLocation'];
const exp = /\/\bsubscriptions\b\/[\S]*\/\bresourceGroups\/[\S]*\/providers\/[\S]*\/customLocations\/([\S]*)/;
const exp = /customlocations\/([\S]*)/;
controllerModel.info.customLocation = <string>exp.exec(rawCustomLocation)?.pop();
}
} catch (err) {