Skip to content

Commit 24c79d0

Browse files
authored
[Aks] Add support of changing AKS node pool count (#16157)
* Add support of changing AKS node pool count * Add support of changing AKS node pool count Co-authored-by: wyunchi-ms <[email protected]>
1 parent eef3a4a commit 24c79d0

File tree

5 files changed

+1795
-911
lines changed

5 files changed

+1795
-911
lines changed

src/Aks/Aks.Test/ScenarioTests/NodePoolTests.ps1

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,30 @@ function Test-NewNodePool
44
# Setup
55
$resourceGroupName = Get-RandomResourceGroupName
66
$kubeClusterName = Get-RandomClusterName
7-
$location = Get-ProviderLocation "Microsoft.ContainerService/managedClusters"
8-
$kubeVersion = "1.15.11"
7+
$location = 'eastus'
8+
$kubeVersion = "1.20.7"
99
$nodeVmSize = "Standard_A2"
1010
$nodeVmSetType = "VirtualMachineScaleSets"
1111
$nodeOsType = "Linux"
1212
$networkPlugin = "azure"
1313
$nodeVmSetType = "VirtualMachineScaleSets"
1414
$winAdminUser = "winuser"
15-
$winPassword = ConvertTo-SecureString -AsPlainText "Password!!123" -Force
15+
$winPassword = ConvertTo-SecureString -AsPlainText "Password!!123Length" -Force
1616
$winNodeName = "windef"
1717
$winNodeOsType = "Windows"
18+
$updatedNodePoolSize = 5
1819

19-
$poolKubeVersion = "1.15.11"
20+
$poolKubeVersion = "1.20.7"
2021

2122
try
2223
{
2324
New-AzResourceGroup -Name $resourceGroupName -Location $location
25+
26+
$cred = $(createTestCredential "618a2a3a-9d44-415a-b0ce-9729253a4ba9" "xkz7Q~MBGEOD0Kg5B-naUO8dj5kvPlmAh7v3P")
27+
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -ServicePrincipalIdAndSecret $cred -NetworkPlugin $networkPlugin `
28+
-KubernetesVersion $kubeVersion -NodeVmSetType $nodeVmSetType -WindowsProfileAdminUserName $winAdminUser `
29+
-WindowsProfileAdminUserPassword $winPassword
2430

25-
#new cluster
26-
if (IsLive) {
27-
$cred = $(createTestCredential "Unicorns" "Puppies")
28-
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -ClientIdAndSecret $cred -NetworkPlugin $networkPlugin `
29-
-KubernetesVersion $kubeVersion -NodeVmSetType $nodeVmSetType -WindowsProfileAdminUserName $winAdminUser `
30-
-WindowsProfileAdminUserPassword $winPassword
31-
} else {
32-
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin -KubernetesVersion $kubeVersion
33-
}
3431

3532
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
3633
Assert-AreEqual $networkPlugin $cluster.NetworkProfile.NetworkPlugin
@@ -49,8 +46,9 @@ function Test-NewNodePool
4946
Assert-AreEqual $nodeVmSetType $winPool.AgentPoolType
5047
Assert-AreEqual $poolKubeVersion $winPool.OrchestratorVersion
5148

52-
$updatedWinPool = $winPool | Update-AzAksNodePool -KubernetesVersion $kubeVersion
49+
$updatedWinPool = $winPool | Update-AzAksNodePool -KubernetesVersion $kubeVersion -NodeCount $updatedNodePoolSize
5350
Assert-AreEqual $kubeVersion $updatedWinPool.OrchestratorVersion
51+
Assert-AreEqual $updatedNodePoolSize $updatedWinPool.Count
5452

5553
$updatedWinPool | Remove-AzAksNodePool -Force
5654
$cluster | Remove-AzAksCluster -Force

0 commit comments

Comments
 (0)