Skip to content

Commit 04e7ecc

Browse files
Add AzureContainerLinux OS SKU support to AKS commands
1 parent 8fbf679 commit 04e7ecc

File tree

4 files changed

+101
-4
lines changed

4 files changed

+101
-4
lines changed

src/azure-cli/azure/cli/command_modules/acs/_consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
CONST_OS_SKU_AZURELINUX3 = "AzureLinux3"
4141
CONST_OS_SKU_UBUNTU2204 = "Ubuntu2204"
4242
CONST_OS_SKU_UBUNTU2404 = "Ubuntu2404"
43+
CONST_OS_SKU_AZURECONTAINERLINUX = "AzureContainerLinux"
4344

4445
# vm set type
4546
CONST_VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets"

src/azure-cli/azure/cli/command_modules/acs/_help.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
- "`az aks get-versions`"
9292
- name: --os-sku
9393
type: string
94-
short-summary: The OS SKU of the agent node pool. Ubuntu or AzureLinux.
94+
short-summary: The OS SKU of the agent node pool. Ubuntu, AzureLinux, AzureLinux3, AzureContainerLinux, Ubuntu2204, or Ubuntu2404.
9595
- name: --ssh-key-value
9696
type: string
9797
short-summary: Public key path or key contents to install on node VMs for SSH access. For example, 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'.
@@ -1892,7 +1892,7 @@
18921892
short-summary: The OS Type. Linux or Windows.
18931893
- name: --os-sku
18941894
type: string
1895-
short-summary: The OS SKU of the agent node pool. Ubuntu, Ubuntu2204, Ubuntu2404, AzureLinux or AzureLinux3 for Linux. Windows2019 or Windows2022 for Windows.
1895+
short-summary: The OS SKU of the agent node pool. Ubuntu, Ubuntu2204, Ubuntu2404, AzureLinux, AzureLinux3, or AzureContainerLinux for Linux. Windows2019 or Windows2022 for Windows.
18961896
- name: --enable-cluster-autoscaler -e
18971897
type: bool
18981898
short-summary: Enable cluster autoscaler.

src/azure-cli/azure/cli/command_modules/acs/_params.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
CONST_NAMESPACE_DELETE_POLICY_KEEP,
4343
CONST_NAMESPACE_DELETE_POLICY_DELETE,
4444
CONST_OS_SKU_AZURELINUX, CONST_OS_SKU_AZURELINUX3,
45+
CONST_OS_SKU_AZURECONTAINERLINUX,
4546
CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_MARINER,
4647
CONST_OS_SKU_UBUNTU, CONST_OS_SKU_UBUNTU2204, CONST_OS_SKU_UBUNTU2404,
4748
CONST_OS_SKU_WINDOWS2019, CONST_OS_SKU_WINDOWS2022,
@@ -186,9 +187,9 @@
186187
node_eviction_policies = [CONST_SPOT_EVICTION_POLICY_DELETE, CONST_SPOT_EVICTION_POLICY_DEALLOCATE]
187188
node_os_disk_types = [CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL]
188189
node_mode_types = [CONST_NODEPOOL_MODE_SYSTEM, CONST_NODEPOOL_MODE_USER, CONST_NODEPOOL_MODE_GATEWAY]
189-
node_os_skus_create = [CONST_OS_SKU_AZURELINUX, CONST_OS_SKU_AZURELINUX3, CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_MARINER, CONST_OS_SKU_UBUNTU2204, CONST_OS_SKU_UBUNTU2404]
190+
node_os_skus_create = [CONST_OS_SKU_AZURELINUX, CONST_OS_SKU_AZURELINUX3, CONST_OS_SKU_AZURECONTAINERLINUX, CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_MARINER, CONST_OS_SKU_UBUNTU2204, CONST_OS_SKU_UBUNTU2404]
190191
node_os_skus = node_os_skus_create + [CONST_OS_SKU_WINDOWS2019, CONST_OS_SKU_WINDOWS2022]
191-
node_os_skus_update = [CONST_OS_SKU_AZURELINUX, CONST_OS_SKU_AZURELINUX3, CONST_OS_SKU_UBUNTU, CONST_OS_SKU_UBUNTU2204, CONST_OS_SKU_UBUNTU2404]
192+
node_os_skus_update = [CONST_OS_SKU_AZURELINUX, CONST_OS_SKU_AZURELINUX3, CONST_OS_SKU_AZURECONTAINERLINUX, CONST_OS_SKU_UBUNTU, CONST_OS_SKU_UBUNTU2204, CONST_OS_SKU_UBUNTU2404]
192193
scale_down_modes = [CONST_SCALE_DOWN_MODE_DELETE, CONST_SCALE_DOWN_MODE_DEALLOCATE]
193194
pod_ip_allocation_modes = [CONST_NETWORK_POD_IP_ALLOCATION_MODE_DYNAMIC_INDIVIDUAL, CONST_NETWORK_POD_IP_ALLOCATION_MODE_STATIC_BLOCK]
194195

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,6 +3869,101 @@ def test_aks_nodepool_add_with_ossku_azurelinux3(self, resource_group, resource_
38693869
self.cmd(
38703870
'aks delete -g {resource_group} -n {name} --yes --no-wait', checks=[self.is_empty()])
38713871

3872+
# live only because AzureContainerLinux RP changes have not rolled out yet,
3873+
# so recordings cannot be created and playback would fail.
3874+
@live_only()
3875+
@AllowLargeResponse()
3876+
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='eastus2euap')
3877+
def test_aks_nodepool_add_with_ossku_azurecontainerlinux(self, resource_group, resource_group_location):
3878+
resource_group_location = 'eastus2euap'
3879+
aks_name = self.create_random_name('cliakstest', 16)
3880+
node_pool_name = self.create_random_name('c', 6)
3881+
node_pool_name_second = self.create_random_name('c', 6)
3882+
self.kwargs.update({
3883+
'resource_group': resource_group,
3884+
'name': aks_name,
3885+
'node_pool_name': node_pool_name,
3886+
'node_pool_name_second': node_pool_name_second,
3887+
'ssh_key_value': self.generate_ssh_keys()
3888+
})
3889+
3890+
create_cmd = 'aks create --resource-group={resource_group} --name={name} ' \
3891+
'--nodepool-name {node_pool_name} -c 1 ' \
3892+
'--ssh-key-value={ssh_key_value}'
3893+
self.cmd(create_cmd, checks=[
3894+
self.check('provisioningState', 'Succeeded'),
3895+
])
3896+
3897+
# nodepool add with AzureContainerLinux os-sku
3898+
self.cmd('aks nodepool add '
3899+
'--resource-group={resource_group} '
3900+
'--cluster-name={name} '
3901+
'--name={node_pool_name_second} '
3902+
'--os-sku AzureContainerLinux '
3903+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AzureContainerLinuxPreview',
3904+
checks=[
3905+
self.check('provisioningState', 'Succeeded'),
3906+
self.check('osSku', 'AzureContainerLinux'),
3907+
])
3908+
3909+
# delete
3910+
self.cmd(
3911+
'aks delete -g {resource_group} -n {name} --yes --no-wait', checks=[self.is_empty()])
3912+
3913+
# live only because AzureContainerLinux RP changes have not rolled out yet,
3914+
# so recordings cannot be created and playback would fail.
3915+
@live_only()
3916+
@AllowLargeResponse()
3917+
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='eastus2euap')
3918+
def test_aks_nodepool_update_with_ossku_azurecontainerlinux(self, resource_group, resource_group_location):
3919+
resource_group_location = 'eastus2euap'
3920+
aks_name = self.create_random_name('cliakstest', 16)
3921+
node_pool_name = self.create_random_name('c', 6)
3922+
node_pool_name_second = self.create_random_name('c', 6)
3923+
self.kwargs.update({
3924+
'resource_group': resource_group,
3925+
'name': aks_name,
3926+
'node_pool_name': node_pool_name,
3927+
'node_pool_name_second': node_pool_name_second,
3928+
'ssh_key_value': self.generate_ssh_keys()
3929+
})
3930+
3931+
create_cmd = 'aks create --resource-group={resource_group} --name={name} ' \
3932+
'--nodepool-name {node_pool_name} -c 1 ' \
3933+
'--ssh-key-value={ssh_key_value}'
3934+
self.cmd(create_cmd, checks=[
3935+
self.check('provisioningState', 'Succeeded'),
3936+
])
3937+
3938+
# add a second nodepool
3939+
self.cmd('aks nodepool add '
3940+
'--resource-group={resource_group} '
3941+
'--cluster-name={name} '
3942+
'--name={node_pool_name_second} '
3943+
'--os-sku AzureLinux',
3944+
checks=[
3945+
self.check('provisioningState', 'Succeeded'),
3946+
self.check('osSku', 'AzureLinux'),
3947+
])
3948+
3949+
# nodepool update to AzureContainerLinux os-sku
3950+
self.cmd('aks nodepool update '
3951+
'--resource-group={resource_group} '
3952+
'--cluster-name={name} '
3953+
'--name={node_pool_name_second} '
3954+
'--os-sku AzureContainerLinux '
3955+
'--enable-secure-boot '
3956+
'--enable-vtpm '
3957+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AzureContainerLinuxPreview',
3958+
checks=[
3959+
self.check('provisioningState', 'Succeeded'),
3960+
self.check('osSku', 'AzureContainerLinux'),
3961+
])
3962+
3963+
# delete
3964+
self.cmd(
3965+
'aks delete -g {resource_group} -n {name} --yes --no-wait', checks=[self.is_empty()])
3966+
38723967
@AllowLargeResponse()
38733968
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')
38743969
def test_aks_nodepool_add_with_ossku_windows2022(self, resource_group, resource_group_location):

0 commit comments

Comments
 (0)