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

2142647 Update AKS API used to get cluster credentials in AKS tasks #20649

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

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

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/uuid": "^9.0.0",
"azure-pipelines-task-lib": "^4.11.0",
"agent-base": "^6.0.2",
"azure-pipelines-tasks-azure-arm-rest": "3.246.5",
"azure-pipelines-tasks-azure-arm-rest": "3.249.0",
"azure-pipelines-tasks-docker-common": "^2.242.0",
"azure-pipelines-tasks-kubernetes-common": "^2.235.0",
"azure-pipelines-tool-lib": "^2.0.7",
Expand Down
332 changes: 166 additions & 166 deletions Tasks/AzureFunctionOnKubernetesV1/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tasks/AzureFunctionOnKubernetesV1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/uuid": "^9.0.0",
"azure-pipelines-task-lib": "^4.11.0",
"agent-base": "^6.0.2",
"azure-pipelines-tasks-azure-arm-rest": "3.246.5",
"azure-pipelines-tasks-azure-arm-rest": "3.249.0",
"azure-pipelines-tasks-docker-common": "^2.242.0",
"azure-pipelines-tasks-kubernetes-common": "^2.235.0",
"azure-pipelines-tool-lib": "^2.0.7",
Expand Down
14 changes: 10 additions & 4 deletions Tasks/AzureFunctionOnKubernetesV1/src/clusterconnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class ClusterConnection {

private loadClusterType(connectionType: string): any {
if(connectionType === "Azure Resource Manager") {
return require("./clusters/armkubernetescluster");
return require("azure-pipelines-tasks-azure-arm-rest/aksUtility")
}
else {
return require("./clusters/generickubernetescluster");
Expand All @@ -32,9 +32,15 @@ export default class ClusterConnection {

// get kubeconfig file path
private async getKubeConfig(connectionType): Promise<string> {
return this.loadClusterType(connectionType).getKubeConfig().then((config) => {
return config;
});
if (connectionType === "Azure Resource Manager") {
const clusterName : string = tl.getInput("kubernetesCluster", true);
const azureSubscriptionEndpoint : string = tl.getInput("azureSubscriptionEndpoint", true);
const resourceGroup : string = tl.getInput("azureResourceGroup", true);
const useClusterAdmin: boolean = tl.getBoolInput('useClusterAdmin');
return this.loadClusterType(connectionType).getKubeConfig(azureSubscriptionEndpoint, resourceGroup, clusterName, useClusterAdmin)
} else {
return this.loadClusterType(connectionType).getKubeConfig()
}
}

private async initialize(): Promise<void> {
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions Tasks/AzureFunctionOnKubernetesV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 247,
"Patch": 2
"Minor": 249,
"Patch": 0
},
"demands": [],
"groups": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureFunctionOnKubernetesV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 247,
"Patch": 2
"Minor": 249,
"Patch": 0
},
"demands": [],
"groups": [
Expand Down
8 changes: 4 additions & 4 deletions Tasks/HelmDeployV0/_buildConfigs/Node20/package-lock.json

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

2 changes: 1 addition & 1 deletion Tasks/HelmDeployV0/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@types/uuid": "^8.3.0",
"agent-base": "6.0.2",
"azure-pipelines-task-lib": "^4.13.0",
"azure-pipelines-tasks-azure-arm-rest": "3.246.5",
"azure-pipelines-tasks-azure-arm-rest": "3.249.0",
"azure-pipelines-tasks-docker-common": "^2.242.0",
"azure-pipelines-tasks-kubernetes-common": "^2.224.1",
"azure-pipelines-tasks-securefiles-common": "^2.207.0",
Expand Down
48 changes: 24 additions & 24 deletions Tasks/HelmDeployV0/package-lock.json

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

2 changes: 1 addition & 1 deletion Tasks/HelmDeployV0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@types/uuid": "^8.3.0",
"agent-base": "6.0.2",
"azure-pipelines-task-lib": "^4.13.0",
"azure-pipelines-tasks-azure-arm-rest": "3.246.5",
"azure-pipelines-tasks-azure-arm-rest": "3.249.0",
"azure-pipelines-tasks-docker-common": "^2.242.0",
"azure-pipelines-tasks-kubernetes-common": "^2.224.1",
"azure-pipelines-tasks-securefiles-common": "^2.207.0",
Expand Down
26 changes: 0 additions & 26 deletions Tasks/HelmDeployV0/src/clusters/armkubernetescluster.ts

This file was deleted.

25 changes: 17 additions & 8 deletions Tasks/HelmDeployV0/src/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getClusterType(): any {
var connectionType = tl.getInput("connectionType", true);
var endpoint = tl.getInput("azureSubscriptionEndpoint")
if (connectionType === "Azure Resource Manager" && endpoint) {
return require("./clusters/armkubernetescluster")
return require("azure-pipelines-tasks-azure-arm-rest/aksUtility")
}

return require("./clusters/generickubernetescluster")
Expand All @@ -51,13 +51,22 @@ function isKubConfigLogoutRequired(command: string): boolean {

// get kubeconfig file path
async function getKubeConfigFile(): Promise<string> {
return getClusterType().getKubeConfig().then((config) => {
var configFilePath = getKubeConfigFilePath();
tl.debug(tl.loc("KubeConfigFilePath", configFilePath));
fs.writeFileSync(configFilePath, config);
fs.chmodSync(configFilePath, '600');
return configFilePath;
});
const connectionType = tl.getInput("connectionType", true)
let result
if (connectionType === "Azure Resource Manager") {
const clusterName : string = tl.getInput("kubernetesCluster", true);
const azureSubscriptionEndpoint : string = tl.getInput("azureSubscriptionEndpoint", true);
const resourceGroup : string = tl.getInput("azureResourceGroup", true);
const useClusterAdmin: boolean = tl.getBoolInput('useClusterAdmin');
result = await getClusterType().getKubeConfig(azureSubscriptionEndpoint, resourceGroup, clusterName, useClusterAdmin)
} else {
result = await getClusterType().getKubeConfig()
}
let configFilePath = getKubeConfigFilePath();
tl.debug(tl.loc("KubeConfigFilePath", configFilePath));
fs.writeFileSync(configFilePath, result);
fs.chmodSync(configFilePath, '600');
return configFilePath;
}

async function runHelmSaveCommand(helmCli: helmcli, kubectlCli: kubernetescli, failOnStderr: boolean): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmDeployV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 247,
"Patch": 2
"Minor": 249,
"Patch": 0
},
"demands": [],
"groups": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmDeployV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 247,
"Patch": 2
"Minor": 249,
"Patch": 0
},
"demands": [],
"groups": [
Expand Down
8 changes: 4 additions & 4 deletions Tasks/HelmDeployV1/_buildConfigs/Node20/package-lock.json

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

2 changes: 1 addition & 1 deletion Tasks/HelmDeployV1/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@types/uuid": "^8.3.0",
"agent-base": "6.0.2",
"azure-pipelines-task-lib": "^4.13.0",
"azure-pipelines-tasks-azure-arm-rest": "3.246.5",
"azure-pipelines-tasks-azure-arm-rest": "3.249.0",
"azure-pipelines-tasks-docker-common": "^2.242.0",
"azure-pipelines-tasks-kubernetes-common": "^2.224.1",
"azure-pipelines-tasks-securefiles-common": "^2.207.0",
Expand Down
Loading