Skip to content

Commit

Permalink
2142647 Update AKS API used to get cluster credentials in AKS tasks (#…
Browse files Browse the repository at this point in the history
…20649)

* 2142647 Update AKS API used to get cluster credentials in AKS tasks

* Package-lock.json updated

* 2142647 moved the common code to common liberary and added help URL for 403 error

* 2142647 fixed registry issues

* 2142647 fixed issue

* 2142647 Update AKS API used to get cluster credentials in AKS tasks

* fixed pipeline Failure
  • Loading branch information
PhilipsonJoseph authored Dec 10, 2024
1 parent f9c922c commit 75ecf01
Show file tree
Hide file tree
Showing 110 changed files with 1,609 additions and 1,823 deletions.

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.250.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
389 changes: 198 additions & 191 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.250.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": 250,
"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": 250,
"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.250.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.250.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": 250,
"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": 250,
"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.250.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

0 comments on commit 75ecf01

Please sign in to comment.