Skip to content

Commit 8775a88

Browse files
authored
az command aks: Add KataVmIsolation workload runtime (#9104)
1 parent e4e2bfb commit 8775a88

File tree

10 files changed

+5457
-9
lines changed

10 files changed

+5457
-9
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
19.0.0b12
16+
+++++++
17+
18+
* `az aks create --workload-runtime KataVmIsolation`: Added the KataVmIsolation workload runtime value.
19+
1520
19.0.0b11
1621
+++++++
1722
* Remove PMK validation for `--azure-keyvault-kms-key-id` parameter.

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
# workload runtime
6262
CONST_WORKLOAD_RUNTIME_OCI_CONTAINER = "OCIContainer"
6363
CONST_WORKLOAD_RUNTIME_WASM_WASI = "WasmWasi"
64-
CONST_WORKLOAD_RUNTIME_KATA_MSHV_VM_ISOLATION = "KataMshvVmIsolation"
64+
CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION = "KataVmIsolation"
65+
CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION = "KataMshvVmIsolation"
6566
CONST_WORKLOAD_RUNTIME_KATA_CC_ISOLATION = "KataCcIsolation"
6667

6768
# gpu instance

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@
127127
CONST_WEEKINDEX_SECOND,
128128
CONST_WEEKINDEX_THIRD,
129129
CONST_WEEKLY_MAINTENANCE_SCHEDULE,
130-
CONST_WORKLOAD_RUNTIME_KATA_MSHV_VM_ISOLATION,
130+
CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION,
131+
CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION,
131132
CONST_WORKLOAD_RUNTIME_KATA_CC_ISOLATION,
132133
CONST_WORKLOAD_RUNTIME_OCI_CONTAINER,
133134
CONST_WORKLOAD_RUNTIME_WASM_WASI,
@@ -314,7 +315,8 @@
314315
workload_runtimes = [
315316
CONST_WORKLOAD_RUNTIME_OCI_CONTAINER,
316317
CONST_WORKLOAD_RUNTIME_WASM_WASI,
317-
CONST_WORKLOAD_RUNTIME_KATA_MSHV_VM_ISOLATION,
318+
CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION,
319+
CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION,
318320
CONST_WORKLOAD_RUNTIME_KATA_CC_ISOLATION,
319321
]
320322
gpu_instance_profiles = [

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_cluster_kata.yaml

Lines changed: 986 additions & 0 deletions
Large diffs are not rendered by default.

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_cluster_kata_mshv_vm_isolation.yaml

Lines changed: 986 additions & 0 deletions
Large diffs are not rendered by default.

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_nodepool_add_with_kata.yaml

Lines changed: 1566 additions & 0 deletions
Large diffs are not rendered by default.

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_nodepool_add_with_kata_mshv_vm_isolation.yaml

Lines changed: 1664 additions & 0 deletions
Large diffs are not rendered by default.

src/aks-preview/azext_aks_preview/tests/latest/test_agentpool_decorator.py

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from azext_aks_preview.__init__ import register_aks_preview_resource_type
1010
from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW
11-
from azext_aks_preview._consts import CONST_WORKLOAD_RUNTIME_OCI_CONTAINER, CONST_SSH_ACCESS_LOCALUSER, CONST_VIRTUAL_MACHINES
11+
from azext_aks_preview._consts import CONST_WORKLOAD_RUNTIME_OCI_CONTAINER, CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION, CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION, CONST_SSH_ACCESS_LOCALUSER, CONST_VIRTUAL_MACHINES
1212
from azext_aks_preview.agentpool_decorator import (
1313
AKSPreviewAgentPoolAddDecorator,
1414
AKSPreviewAgentPoolContext,
@@ -618,6 +618,35 @@ def common_get_disable_fips_image(self):
618618
ctx_1.attach_agentpool(agentpool_1)
619619
self.assertEqual(ctx_1.get_disable_fips_image(), True)
620620

621+
def common_get_enable_kata_image(self):
622+
# testing new kata naming convention
623+
ctx_1 = AKSPreviewAgentPoolContext(
624+
self.cmd,
625+
AKSAgentPoolParamDict({
626+
"workload_runtime": CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION,
627+
}),
628+
self.models,
629+
DecoratorMode.CREATE,
630+
self.agentpool_decorator_mode,
631+
)
632+
agentpool_1 = self.create_initialized_agentpool_instance(workload_runtime=CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION)
633+
ctx_1.attach_agentpool(agentpool_1)
634+
self.assertEqual(ctx_1.get_workload_runtime(), CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION)
635+
636+
# tesing old kata naming convention
637+
ctx_2 = AKSPreviewAgentPoolContext(
638+
self.cmd,
639+
AKSAgentPoolParamDict({
640+
"workload_runtime": CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION,
641+
}),
642+
self.models,
643+
DecoratorMode.CREATE,
644+
self.agentpool_decorator_mode,
645+
)
646+
agentpool_2 = self.create_initialized_agentpool_instance(workload_runtime=CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION)
647+
ctx_2.attach_agentpool(agentpool_2)
648+
self.assertEqual(ctx_2.get_workload_runtime(), CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION)
649+
621650
def common_get_agentpool_windows_profile(self):
622651
ctx_1 = AKSPreviewAgentPoolContext(
623652
self.cmd,
@@ -1034,12 +1063,15 @@ def test_get_enable_vtpm(self):
10341063
def test_get_disable_vtpm(self):
10351064
self.common_get_disable_vtpm()
10361065

1037-
def common_get_enable_fips_image(self):
1066+
def test_common_get_enable_fips_image(self):
10381067
self.common_get_enable_fips_image()
10391068

1040-
def common_get_disable_fips_image(self):
1069+
def test_common_get_disable_fips_image(self):
10411070
self.common_get_disable_fips_image()
10421071

1072+
def test_common_get_enable_kata_image(self):
1073+
self.common_get_enable_kata_image()
1074+
10431075
def test_get_agentpool_windows_profile(self):
10441076
self.common_get_agentpool_windows_profile()
10451077

@@ -1116,9 +1148,12 @@ def test_get_disable_secure_boot(self):
11161148
def test_get_enable_vtpm(self):
11171149
self.common_get_enable_vtpm()
11181150

1119-
def common_get_enable_fips_image(self):
1151+
def test_common_get_enable_fips_image(self):
11201152
self.common_get_enable_fips_image()
11211153

1154+
def test_common_get_enable_kata_image(self):
1155+
self.common_get_enable_kata_image()
1156+
11221157
def test_get_agentpool_windows_profile(self):
11231158
self.common_get_agentpool_windows_profile()
11241159

src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

Lines changed: 204 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import tempfile
1111
import time
1212

13-
from azext_aks_preview._consts import CONST_CUSTOM_CA_TEST_CERT
13+
from azext_aks_preview._consts import CONST_CUSTOM_CA_TEST_CERT, CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION, CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION
1414
from azext_aks_preview._format import aks_machine_list_table_format
1515
from azext_aks_preview.tests.latest.custom_preparers import (
1616
AKSCustomResourceGroupPreparer,
@@ -3062,6 +3062,209 @@ def test_aks_nodepool_add_with_ossku_windows2025(
30623062
checks=[self.is_empty()],
30633063
)
30643064

3065+
@AllowLargeResponse()
3066+
@AKSCustomResourceGroupPreparer(
3067+
random_name_length=17, name_prefix="clitest", location="westus2"
3068+
)
3069+
def test_aks_cluster_kata(
3070+
self, resource_group, resource_group_location
3071+
):
3072+
# reset the count so in replay mode the random names will start with 0
3073+
self.test_resources_count = 0
3074+
# kwargs for string formatting
3075+
aks_name = self.create_random_name("cliakstest", 16)
3076+
self.kwargs.update(
3077+
{
3078+
"resource_group": resource_group,
3079+
"name": aks_name,
3080+
"dns_name_prefix": self.create_random_name("cliaksdns", 16),
3081+
"location": resource_group_location,
3082+
"resource_type": "Microsoft.ContainerService/ManagedClusters",
3083+
"workload_runtime": CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION,
3084+
"ssh_key_value": self.generate_ssh_keys(),
3085+
}
3086+
)
3087+
3088+
# create
3089+
create_cmd = (
3090+
"aks create --resource-group={resource_group} --name={name} --location={location} "
3091+
"--os-sku AzureLinux --workload-runtime {workload_runtime} --node-count 1 "
3092+
"--ssh-key-value={ssh_key_value} --node-vm-size Standard_D4s_v3"
3093+
)
3094+
self.cmd(
3095+
create_cmd,
3096+
checks=[
3097+
self.exists("fqdn"),
3098+
self.exists("nodeResourceGroup"),
3099+
self.check("provisioningState", "Succeeded"),
3100+
self.check("agentPoolProfiles[0].workloadRuntime", CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION),
3101+
],
3102+
)
3103+
3104+
# delete
3105+
self.cmd(
3106+
"aks delete -g {resource_group} -n {name} --yes --no-wait",
3107+
checks=[self.is_empty()],
3108+
)
3109+
3110+
@AllowLargeResponse()
3111+
@AKSCustomResourceGroupPreparer(
3112+
random_name_length=17, name_prefix="clitest", location="westus2"
3113+
)
3114+
def test_aks_nodepool_add_with_kata(
3115+
self, resource_group, resource_group_location
3116+
):
3117+
# reset the count so in replay mode the random names will start with 0
3118+
self.test_resources_count = 0
3119+
# kwargs for string formatting
3120+
aks_name = self.create_random_name("cliakstest", 16)
3121+
node_pool_name = self.create_random_name('c', 6)
3122+
node_pool_name_second = self.create_random_name('c', 6)
3123+
self.kwargs.update(
3124+
{
3125+
"resource_group": resource_group,
3126+
"name": aks_name,
3127+
"node_pool_name": node_pool_name,
3128+
"node_pool_name_second": node_pool_name_second,
3129+
"location": resource_group_location,
3130+
"resource_type": "Microsoft.ContainerService/ManagedClusters",
3131+
"workload_runtime": CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION,
3132+
"ssh_key_value": self.generate_ssh_keys(),
3133+
}
3134+
)
3135+
3136+
# create
3137+
create_cmd = (
3138+
"aks create --resource-group={resource_group} --name={name} "
3139+
"--nodepool-name {node_pool_name} -c 1 --ssh-key-value={ssh_key_value}"
3140+
)
3141+
self.cmd(create_cmd, checks=[
3142+
self.check('provisioningState', 'Succeeded'),
3143+
])
3144+
3145+
# nodepool update with kata
3146+
update_cmd = (
3147+
"aks nodepool add --cluster-name={name} --resource-group={resource_group} "
3148+
"--name={node_pool_name_second} --os-sku AzureLinux "
3149+
"--workload-runtime KataVmIsolation --node-vm-size Standard_D4s_v3"
3150+
)
3151+
3152+
self.cmd(
3153+
update_cmd,
3154+
checks=[
3155+
self.check("provisioningState", "Succeeded"),
3156+
self.check("workloadRuntime", CONST_WORKLOAD_RUNTIME_KATA_VM_ISOLATION),
3157+
],
3158+
)
3159+
3160+
# delete
3161+
self.cmd(
3162+
"aks delete -g {resource_group} -n {name} --yes --no-wait",
3163+
checks=[self.is_empty()],
3164+
)
3165+
3166+
@AllowLargeResponse()
3167+
@AKSCustomResourceGroupPreparer(
3168+
random_name_length=17, name_prefix="clitest", location="westus2"
3169+
)
3170+
def test_aks_cluster_kata_mshv_vm_isolation(
3171+
self, resource_group, resource_group_location
3172+
):
3173+
# Testing the old kata name that is still in use in aks-preview
3174+
# reset the count so in replay mode the random names will start with 0
3175+
self.test_resources_count = 0
3176+
# kwargs for string formatting
3177+
aks_name = self.create_random_name("cliakstest", 16)
3178+
self.kwargs.update(
3179+
{
3180+
"resource_group": resource_group,
3181+
"name": aks_name,
3182+
"dns_name_prefix": self.create_random_name("cliaksdns", 16),
3183+
"location": resource_group_location,
3184+
"resource_type": "Microsoft.ContainerService/ManagedClusters",
3185+
"workload_runtime": CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION,
3186+
"ssh_key_value": self.generate_ssh_keys(),
3187+
}
3188+
)
3189+
3190+
# create
3191+
create_cmd = (
3192+
"aks create --resource-group={resource_group} --name={name} --location={location} "
3193+
"--os-sku AzureLinux --workload-runtime {workload_runtime} --node-count 1 "
3194+
"--ssh-key-value={ssh_key_value} --node-vm-size Standard_D4s_v3"
3195+
)
3196+
self.cmd(
3197+
create_cmd,
3198+
checks=[
3199+
self.exists("fqdn"),
3200+
self.exists("nodeResourceGroup"),
3201+
self.check("provisioningState", "Succeeded"),
3202+
self.check("agentPoolProfiles[0].workloadRuntime", CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION),
3203+
],
3204+
)
3205+
3206+
# delete
3207+
self.cmd(
3208+
"aks delete -g {resource_group} -n {name} --yes --no-wait",
3209+
checks=[self.is_empty()],
3210+
)
3211+
3212+
@AllowLargeResponse()
3213+
@AKSCustomResourceGroupPreparer(
3214+
random_name_length=17, name_prefix="clitest", location="westus2"
3215+
)
3216+
def test_aks_nodepool_add_with_kata_mshv_vm_isolation(
3217+
self, resource_group, resource_group_location
3218+
):
3219+
# reset the count so in replay mode the random names will start with 0
3220+
self.test_resources_count = 0
3221+
# kwargs for string formatting
3222+
aks_name = self.create_random_name("cliakstest", 16)
3223+
node_pool_name = self.create_random_name('c', 6)
3224+
node_pool_name_second = self.create_random_name('c', 6)
3225+
self.kwargs.update(
3226+
{
3227+
"resource_group": resource_group,
3228+
"name": aks_name,
3229+
"node_pool_name": node_pool_name,
3230+
"node_pool_name_second": node_pool_name_second,
3231+
"location": resource_group_location,
3232+
"resource_type": "Microsoft.ContainerService/ManagedClusters",
3233+
"workload_runtime": CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION,
3234+
"ssh_key_value": self.generate_ssh_keys(),
3235+
}
3236+
)
3237+
3238+
# create
3239+
create_cmd = (
3240+
"aks create --resource-group={resource_group} --name={name} "
3241+
"--nodepool-name {node_pool_name} -c 1 --ssh-key-value={ssh_key_value}"
3242+
)
3243+
self.cmd(create_cmd, checks=[
3244+
self.check('provisioningState', 'Succeeded'),
3245+
])
3246+
3247+
# nodepool update with kata
3248+
update_cmd = (
3249+
"aks nodepool add --cluster-name={name} --resource-group={resource_group} "
3250+
"--name={node_pool_name_second} --os-sku AzureLinux "
3251+
"--workload-runtime {workload_runtime} --node-vm-size Standard_D4s_v3"
3252+
)
3253+
3254+
self.cmd(
3255+
update_cmd,
3256+
checks=[
3257+
self.check("provisioningState", "Succeeded"),
3258+
self.check("workloadRuntime", CONST_WORKLOAD_RUNTIME_OLD_KATA_VM_ISOLATION),
3259+
],
3260+
)
3261+
3262+
# delete
3263+
self.cmd(
3264+
"aks delete -g {resource_group} -n {name} --yes --no-wait",
3265+
checks=[self.is_empty()],
3266+
)
3267+
30653268
@AllowLargeResponse()
30663269
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus')
30673270
def test_aks_nodepool_add_with_ossku_ubuntu2204(self, resource_group, resource_group_location):

src/aks-preview/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from setuptools import find_packages, setup
1111

12-
VERSION = "19.0.0b11"
12+
VERSION = "19.0.0b12"
1313

1414
CLASSIFIERS = [
1515
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)