Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arm-containerservice deprecated pacakages warning. #23

Merged
merged 3 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 131 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,10 @@
"vscode": "^1.1.6"
},
"dependencies": {
"@azure/arm-containerservice": "^7.0.1",
"azure-arm-containerservice": "^7.0.0",
"@azure/arm-containerservice": "11.0.0",
"azure-arm-resource": "^7.3.0",
"handlebars": "^4.7.6",
"js-yaml": "^3.13.1",
"ms-rest": "^2.5.0",
"ms-rest-azure": "^2.6.0",
"vscode-azureextensionui": "^0.27.1",
"vscode-kubernetes-tools-api": "^1.0.0"
},
Expand Down
10 changes: 8 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
import * as azcs from 'azure-arm-containerservice'; // deprecated, but @azure/arm-containerservice doesn't play nicely with AzureAccount, so...
import * as azcs from '@azure/arm-containerservice';
import * as msRestJs from "@azure/ms-rest-js";

import { parseResource } from './azure-api-utils';
import AksClusterTreeItem from './tree/aksClusterTreeItem';
Expand Down Expand Up @@ -47,7 +48,8 @@ async function getClusterKubeconfig(target: AksClusterTreeItem): Promise<string
vscode.window.showErrorMessage(`Invalid ARM id ${target.id}`);
return;
}
const client = new azcs.ContainerServiceClient(target.root.credentials, target.root.subscriptionId); // TODO: safely

const client = new azcs.ContainerServiceClient(restJSCredentialsFrom(target), target.root.subscriptionId); // TODO: safely
try {
const accessProfile = await client.managedClusters.getAccessProfile(resourceGroupName, name, 'clusterUser');
const kubeconfig = accessProfile.kubeConfig!.toString(); // TODO: safely
Expand All @@ -57,3 +59,7 @@ async function getClusterKubeconfig(target: AksClusterTreeItem): Promise<string
return undefined;
}
}

function restJSCredentialsFrom(target: AksClusterTreeItem) {
return <msRestJs.ServiceClientCredentials><unknown>target.root.credentials;
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"target": "es6",
"outDir": "out",
"lib": [
"es6"
"es6",
"DOM"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems strange and I don't get why we would need DOM here (I mean I get that we need it here to make things work but I don't know why don't they work without it and is this the right fix). Is there documentation that prescribes this? If not, can we check in with the team that this is what they expect?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh never mind I realised you had already posted the link and oh dear yeah that's not good.

Copy link
Member Author

@Tatsinnit Tatsinnit May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😊 Yes, that is almost year and above when folks found the issue in “ms-rest-js” , so essentially deprecation help page should link the existing bug for folks who are fixing this deprecation to know what trick will actually fix their typing issues. 😎🙏

For those who might just read this comment here is an open bug: Azure/ms-rest-js#367

],
"sourceMap": true,
"rootDir": "src",
Expand Down