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

[Aks]Promised breaking changes #13252

Merged
merged 2 commits into from
Oct 20, 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
38 changes: 19 additions & 19 deletions src/Aks/Aks.Test/ScenarioTests/KubernetesTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ function Test-NewAzAksSimple

if (IsLive) {
$cred = $(createTestCredential "Unicorns" "Puppies")
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -ClientIdAndSecret $cred
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -ClientIdAndSecret $cred
} else {
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize
}
$cluster = Get-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-NotNull $cluster.Fqdn
Assert-NotNull $cluster.DnsPrefix
Assert-AreEqual 1 $cluster.AgentPoolProfiles.Length
Assert-AreEqual 3 $cluster.AgentPoolProfiles[0].Count;
$cluster = $cluster | Set-AzAks -NodeCount 2
$cluster = $cluster | Set-AzAksCluster -NodeCount 2
Assert-AreEqual 2 $cluster.AgentPoolProfiles[0].Count;
$cluster | Import-AzAksCredential -Force
$cluster | Remove-AzAks -Force
$cluster | Remove-AzAksCluster -Force
}
finally
{
Expand All @@ -53,19 +53,19 @@ function Test-NewAzAksWithAcr

if (IsLive) {
$cred = $(createTestCredential "Unicorns" "Puppies")
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -ClientIdAndSecret $cred -AcrNameToAttach $acrName
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -ClientIdAndSecret $cred -AcrNameToAttach $acrName
} else {
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -AcrNameToAttach $acrName
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -AcrNameToAttach $acrName
}
$cluster = Get-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-NotNull $cluster.Fqdn
Assert-NotNull $cluster.DnsPrefix
Assert-AreEqual 1 $cluster.AgentPoolProfiles.Length
Assert-AreEqual 3 $cluster.AgentPoolProfiles[0].Count;
$cluster = $cluster | Set-AzAks -NodeCount 2
Assert-AreEqual 2 $cluster.AgentPoolProfiles[0].Count;
$cluster | Import-AzAksCredential -Force
$cluster | Remove-AzAks -Force
$cluster | Remove-AzAksCluster -Force
}
finally
{
Expand Down Expand Up @@ -103,17 +103,17 @@ function Test-NewAzAks

if (IsLive) {
$cred = $(createTestCredential "Unicorns" "Puppies")
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin `
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin `
-KubernetesVersion $kubeVersion -EnableRbac -LoadBalancerSku $loadBalancerSku -LinuxProfileAdminUserName $linuxAdminUser -DnsNamePrefix $dnsNamePrefix `
-NodeName $nodeName -NodeOsType $nodeOsType -EnableNodeAutoScaling -NodeCount $nodeCount -NodeOsDiskSize $nodeDiskSize -NodeVmSize $nodeVmSize `
-NodeName $nodeName -EnableNodeAutoScaling -NodeCount $nodeCount -NodeOsDiskSize $nodeDiskSize -NodeVmSize $nodeVmSize `
-NodeMaxCount $nodeMaxCount -NodeMinCount $nodeMinCount -NodeMaxPodCount $maxPodCount -NodeSetPriority Regular -NodeScaleSetEvictionPolicy Deallocate -NodeVmSetType VirtualMachineScaleSets
} else {
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin `
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin `
-KubernetesVersion $kubeVersion -EnableRbac -LoadBalancerSku $loadBalancerSku -LinuxProfileAdminUserName $linuxAdminUser -DnsNamePrefix $dnsNamePrefix `
-NodeName $nodeName -NodeOsType $nodeOsType -EnableNodeAutoScaling -NodeCount $nodeCount -NodeOsDiskSize $nodeDiskSize -NodeVmSize $nodeVmSize `
-NodeName $nodeName -EnableNodeAutoScaling -NodeCount $nodeCount -NodeOsDiskSize $nodeDiskSize -NodeVmSize $nodeVmSize `
-NodeMaxCount $nodeMaxCount -NodeMinCount $nodeMinCount -NodeMaxPodCount $maxPodCount -NodeSetPriority Regular -NodeScaleSetEvictionPolicy Deallocate -NodeVmSetType VirtualMachineScaleSets
}
$cluster = Get-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-NotNull $cluster.Fqdn
Assert-AreEqual $dnsNamePrefix $cluster.DnsPrefix
Assert-AreEqual $kubeVersion $cluster.KubernetesVersion
Expand All @@ -133,12 +133,12 @@ function Test-NewAzAks
Assert-AreEqual $enableAutoScaling $cluster.AgentPoolProfiles[0].EnableAutoScaling

Assert-AreEqual 1 $cluster.AgentPoolProfiles.Length
$cluster = $cluster | Set-AzAks -NodeName $nodeName -NodeMinCount 2 -NodeMaxCount 28 -KubernetesVersion $updatedKubeVersion
$cluster = $cluster | Set-AzAksCluster -NodeName $nodeName -NodeMinCount 2 -NodeMaxCount 28 -KubernetesVersion $updatedKubeVersion
Assert-AreEqual 2 $cluster.AgentPoolProfiles[0].MinCount
Assert-AreEqual 28 $cluster.AgentPoolProfiles[0].MaxCount;
Assert-AreEqual $updatedKubeVersion $cluster.KubernetesVersion
$cluster | Import-AzAksCredential -Force
$cluster | Remove-AzAks -Force
$cluster | Remove-AzAksCluster -Force
}
finally
{
Expand All @@ -157,16 +157,16 @@ function Test-NewAzAksAddons
{
New-AzResourceGroup -Name $resourceGroupName -Location $location

New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -AddOnNameToBeEnabled KubeDashboard,HttpApplicationRouting
$cluster = Get-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -AddOnNameToBeEnabled KubeDashboard,HttpApplicationRouting
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-AreEqual $true $cluster.AddonProfiles['httpapplicationrouting'].Enabled
Assert-AreEqual $true $cluster.AddonProfiles['httpapplicationrouting'].Enabled

$cluster = $cluster | Disable-AzAksAddon -Name HttpApplicationRouting
Assert-AreEqual $false $cluster.AddonProfiles['httpapplicationrouting'].Enabled
$cluster = $cluster | Enable-AzAksAddon -Name HttpApplicationRouting
Assert-AreEqual $true $cluster.AddonProfiles['httpapplicationrouting'].Enabled
$cluster | Remove-AzAks -Force
$cluster | Remove-AzAksCluster -Force
}
finally
{
Expand Down
8 changes: 4 additions & 4 deletions src/Aks/Aks.Test/ScenarioTests/NodePoolTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ function Test-NewNodePool
#new cluster
if (IsLive) {
$cred = $(createTestCredential "Unicorns" "Puppies")
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -ClientIdAndSecret $cred -NetworkPlugin $networkPlugin `
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -ClientIdAndSecret $cred -NetworkPlugin $networkPlugin `
-KubernetesVersion $kubeVersion -NodeVmSetType $nodeVmSetType -WindowsProfileAdminUserName $winAdminUser `
-WindowsProfileAdminUserPassword $winPassword
} else {
New-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin -KubernetesVersion $kubeVersion
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NetworkPlugin $networkPlugin -KubernetesVersion $kubeVersion
}

$cluster = Get-AzAks -ResourceGroupName $resourceGroupName -Name $kubeClusterName
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-AreEqual $networkPlugin $cluster.NetworkProfile.NetworkPlugin
Assert-AreEqual $nodeOsType $cluster.AgentPoolProfiles[0].OsType
Assert-AreEqual 1 $cluster.AgentPoolProfiles.Count
Expand All @@ -53,7 +53,7 @@ function Test-NewNodePool
Assert-AreEqual $kubeVersion $updatedWinPool.OrchestratorVersion

$updatedWinPool | Remove-AzAksNodePool -Force
$cluster | Remove-AzAks -Force
$cluster | Remove-AzAksCluster -Force
}
finally
{
Expand Down
6 changes: 6 additions & 0 deletions src/Aks/Aks/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
- Additional information about change #1
-->
## Upcoming Release
* [Breaking Change] Removed cmdlet alias `Get-AzAks`, `New-AzAks`, `Remove-AzAks` and `Set-AzAks`.
* [Breaking Change] Removed parameter alias `ClientIdAndSecret` in `New-AzAksCluster` and `Set-AzAksCluster`.
* [Breaking Change] Changed the default value of `NodeVmSetType` in `New-AzAksCluster` from `AvailabilitySet` to `VirtualMachineScaleSets`.
* [Breaking Change] Changed the default value of `NetworkPlugin` in `New-AzAksCluster` from `None` to `azure`.
* [Breaking Change] Removed parameter `NodeOsType` in `New-AzAksCluster` as it supports only one value Linux.


## Version 1.3.0
* Added client side parameter validation logic for `New-AzAksCluster`, `Set-AzAksCluster` and `New-AzAksNodePool`. [#12372]
Expand Down
2 changes: 0 additions & 2 deletions src/Aks/Aks/Commands/CreateOrUpdateKubeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public abstract class CreateOrUpdateKubeBase : KubeCmdletBase
Mandatory = false,
ParameterSetName = DefaultParamSet,
HelpMessage = "The client id and client secret associated with the AAD application / service principal.")]
[Alias("ClientIdAndSecret")]
[CmdletParameterBreakingChange("ClientIdAndSecret", ReplaceMentCmdletParameterName = "ServicePrincipalIdAndSecret")]
public PSCredential ServicePrincipalIdAndSecret { get; set; }

[Parameter(Mandatory = false,
Expand Down
2 changes: 0 additions & 2 deletions src/Aks/Aks/Commands/GetAzureRmAks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

namespace Microsoft.Azure.Commands.Aks
{
[CmdletDeprecation(ReplacementCmdletName = "Get-AzAksCluster")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AksCluster", DefaultParameterSetName = ResourceGroupParameterSet)]
[Alias("Get-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Aks")]
[OutputType(typeof(PSKubernetesCluster))]
public class GetAzureRmAks : KubeCmdletBase
{
Expand Down
7 changes: 0 additions & 7 deletions src/Aks/Aks/Commands/NewAzureRmAks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

namespace Microsoft.Azure.Commands.Aks
{
[CmdletDeprecation(ReplacementCmdletName = "New-AzAksCluster")]
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AksCluster", DefaultParameterSetName = DefaultParamSet, SupportsShouldProcess = true)]
[Alias("New-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Aks")]
[OutputType(typeof(PSKubernetesCluster))]
public class NewAzureRmAks : NewKubeBase
{
Expand Down Expand Up @@ -101,11 +99,6 @@ private void PreValidate()
throw new ArgumentException(Resources.NetworkPluginShouldBeAzure);
}
}
if (string.Equals(this.NodeOsType, "Windows"))
{
if (NodeName?.Length > 6)
throw new PSInvalidOperationException(Resources.WindowsNodePoolNameLengthLimitation);
}
}

private void VerifySshKeyGenBinaryExist()
Expand Down
16 changes: 3 additions & 13 deletions src/Aks/Aks/Commands/NewKubeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace Microsoft.Azure.Commands.Aks
{
public abstract class NewKubeBase : CreateOrUpdateKubeBase
{
[CmdletParameterBreakingChange("NodeVmSetType", ChangeDescription = "Default value will be changed from AvailabilitySet to VirtualMachineScaleSets.")]
[Parameter(Mandatory = false, HelpMessage = "Represents types of an node pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'")]
[PSArgumentCompleter("AvailabilitySet", "VirtualMachineScaleSets")]
public string NodeVmSetType { get; set; }
Expand All @@ -42,11 +41,6 @@ public abstract class NewKubeBase : CreateOrUpdateKubeBase
[Parameter(Mandatory = false, HelpMessage = "Maximum number of pods that can run on node.")]
public int NodeMaxPodCount { get; set; }

[CmdletParameterBreakingChange("NodeOsType", ChangeDescription = "NodeOsType will be removed as it supports only one value Linux.")]
[Parameter(Mandatory = false, HelpMessage = "OsType to be used to specify os type, currently support 'Linux' only here.")]
[PSArgumentCompleter("Linux")]
public string NodeOsType { get; set; }

////Hide it as it expects GA by around May
//[Parameter(Mandatory = false, HelpMessage = "Whether to enable public IP for nodes")]
//public SwitchParameter EnableNodePublicIp { get; set; }
Expand Down Expand Up @@ -120,10 +114,9 @@ public abstract class NewKubeBase : CreateOrUpdateKubeBase
[ValidateSecureString(RegularExpression = "^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\\^&\\*\\(\\)])[a-zA-Z\\d!@#$%\\^&\\*\\(\\)]{12,123}$")]
public SecureString WindowsProfileAdminUserPassword { get; set; }

[CmdletParameterBreakingChange("NetworkPlugin", ChangeDescription = "Default value will be changed from None to azure.")]
[Parameter(Mandatory = false, HelpMessage = "Network plugin used for building Kubernetes network.")]
[PSArgumentCompleter("azure", "kubenet")]
public string NetworkPlugin { get; set; }
public string NetworkPlugin { get; set; } = "azure";

[Parameter(Mandatory = false, HelpMessage = "The load balancer sku for the managed cluster.")]
[PSArgumentCompleter("basic", "standard")]
Expand Down Expand Up @@ -217,12 +210,9 @@ private ManagedClusterAgentPoolProfile GetAgentPoolProfile()
count: NodeCount,
vmSize: NodeVmSize,
osDiskSizeGB: NodeOsDiskSize,
type: NodeVmSetType ?? "AvailabilitySet",
type: NodeVmSetType ?? "VirtualMachineScaleSets",
vnetSubnetID: NodeVnetSubnetID);
if (this.IsParameterBound(c => c.NodeOsType))
{
defaultAgentPoolProfile.OsType = NodeOsType;
}
defaultAgentPoolProfile.OsType = "Linux";
if (this.IsParameterBound(c => c.NodeMaxPodCount))
{
defaultAgentPoolProfile.MaxPods = NodeMaxPodCount;
Expand Down
2 changes: 0 additions & 2 deletions src/Aks/Aks/Commands/RemoveAzureRmAks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

namespace Microsoft.Azure.Commands.Aks
{
[CmdletDeprecation(ReplacementCmdletName = "Remove-AzAksCluster")]
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AksCluster", SupportsShouldProcess = true, DefaultParameterSetName = GroupNameParameterSet)]
[Alias("Remove-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Aks")]
[OutputType(typeof(bool))]
public class RemoveAzureRmAks : KubeCmdletBase
{
Expand Down
2 changes: 0 additions & 2 deletions src/Aks/Aks/Commands/SetAzureRmAks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@

namespace Microsoft.Azure.Commands.Aks
{
[CmdletDeprecation(ReplacementCmdletName = "Set-AzAksCluster")]
[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AksCluster", DefaultParameterSetName = DefaultParamSet, SupportsShouldProcess = true)]
[Alias("Set-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Aks")]
[OutputType(typeof(PSKubernetesCluster))]
public class SetAzureRmAks : CreateOrUpdateKubeBase
{
Expand Down
23 changes: 4 additions & 19 deletions src/Aks/Aks/help/New-AzAksCluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create a new managed Kubernetes cluster.

```
New-AzAksCluster [-Force] [-GenerateSshKey] [-NodeVmSetType <String>] [-NodeVnetSubnetID <String>]
[-NodeMaxPodCount <Int32>] [-NodeOsType <String>] [-NodeSetPriority <String>] [-NodePoolMode <String>]
[-NodeMaxPodCount <Int32>] [-NodeSetPriority <String>] [-NodePoolMode <String>]
[-NodeScaleSetEvictionPolicy <String>] [-AddOnNameToBeEnabled <String[]>] [-WorkspaceResourceId <String>]
[-SubnetName <String>] [-AcrNameToAttach <String>] [-EnableRbac] [-WindowsProfileAdminUserName <String>]
[-WindowsProfileAdminUserPassword <SecureString>] [-NetworkPlugin <String>] [-LoadBalancerSku <String>]
Expand Down Expand Up @@ -271,7 +271,7 @@ Aliases:

Required: False
Position: Named
Default value: None
Default value: azure
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down Expand Up @@ -366,21 +366,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -NodeOsType
OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -NodePoolMode
NodePoolMode represents mode of an node pool.

Expand Down Expand Up @@ -436,7 +421,7 @@ Aliases:

Required: False
Position: Named
Default value: None
Default value: VirtualMachineScaleSets
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down Expand Up @@ -492,7 +477,7 @@ The client id and client secret associated with the AAD application / service pr
```yaml
Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases: ClientIdAndSecret
Aliases:

Required: False
Position: 2
Expand Down
2 changes: 1 addition & 1 deletion src/Aks/Aks/help/Set-AzAksCluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ The client id and client secret associated with the AAD application / service pr
```yaml
Type: System.Management.Automation.PSCredential
Parameter Sets: defaultParameterSet
Aliases: ClientIdAndSecret
Aliases:

Required: False
Position: 2
Expand Down
Loading