Skip to content

Commit 91a22a9

Browse files
committed
Updated to KataVmIsolation.
1 parent e80d850 commit 91a22a9

4 files changed

Lines changed: 134 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@
250250
# node provisioning default pools
251251
CONST_NODE_PROVISIONING_DEFAULT_POOLS_NONE = "None"
252252
CONST_NODE_PROVISIONING_DEFAULT_POOLS_AUTO = "Auto"
253+
# consts for workloadruntime
254+
CONST_KATA_VM_ISOLATION = "KataVmIsolation"
253255

254256

255257
# consts for decorator pattern

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@
624624
short-summary: Set the workload runtime.
625625
long-summary: |
626626
Azure provides a different workload-runtime to enable Kata supported workloads in your nodepools. The following values can be specified:
627-
- "KataMshvVmIsolation" for Kata.
627+
- "KataVmIsolation" for Kata.
628628
629629
examples:
630630
- name: Create a Kubernetes cluster with an existing SSH public key.
@@ -711,6 +711,8 @@
711711
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None
712712
- name: Create a kubernetes cluster with KataMshvVmIsolation enabled.
713713
text: az aks create -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataMshvVmIsolation --node-count 1
714+
- name: Create a kubernetes cluster with KataVmIsolation enabled.
715+
text: az aks create -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataVmIsolation --node-count 1
714716
"""
715717

716718
helps["aks update"] = """
@@ -1820,7 +1822,7 @@
18201822
short-summary: Set the workload runtime.
18211823
long-summary: |
18221824
Azure provides a different workload-runtime to enable Kata supported workloads in your nodepools. The following values can be specified:
1823-
- "KataMshvVmIsolation" for Kata.
1825+
- "KataVmIsolation" for Kata.
18241826
18251827
examples:
18261828
- name: Create a nodepool in an existing AKS cluster with ephemeral os enabled.
@@ -1845,6 +1847,8 @@
18451847
text: az aks nodepool add -g MyResourceGroup -n MyNodePool --cluster-name MyMC --vm-set-type VirtualMachines --vm-sizes "VMSize1,VMSize2" --node-count 3
18461848
- name: Create a kubernetes cluster with KataMshvVmIsolation enabled.
18471849
text: az aks nodepool add -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataMshvVmIsolation --node-count 1
1850+
- name: Create a kubernetes cluster with KataVmIsolation enabled.
1851+
text: az aks nodepool add -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataVmIsolation --node-count 1
18481852
"""
18491853

18501854
helps["aks nodepool delete"] = """

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
]
330330

331331
workload_runtime_types = [
332-
CONST_KATA_MSHV_VM_ISOLATION,
332+
CONST_KATA_VM_ISOLATION,
333333
]
334334

335335

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

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,131 @@ def test_aks_create_update_fips_flow(self, resource_group, resource_group_locati
27302730
)
27312731

27322732
# TODO(mheberling): Add kata tests
2733+
@AllowLargeResponse()
2734+
@AKSCustomResourceGroupPreparer(
2735+
random_name_length=17, name_prefix="clitest", location="westcentralus"
2736+
)
2737+
def test_aks_create_kata_flow(self, resource_group, resource_group_location):
2738+
# reset the count so in replay mode the random names will start with 0
2739+
self.test_resources_count = 0
2740+
aks_name = self.create_random_name("cliakstest", 16)
2741+
node_pool_name = self.create_random_name("c", 6)
2742+
# node_pool_name_second = self.create_random_name("c", 6)
2743+
self.kwargs.update(
2744+
{
2745+
"resource_group": resource_group,
2746+
"name": aks_name,
2747+
"dns_name_prefix": self.create_random_name("cliaksdns", 16),
2748+
"location": resource_group_location,
2749+
"resource_type": "Microsoft.ContainerService/ManagedClusters",
2750+
"node_pool_name": node_pool_name,
2751+
# "node_pool_name_second": node_pool_name_second,
2752+
# "ssh_key_value": self.generate_ssh_keys(),
2753+
}
2754+
)
2755+
2756+
# 1. create
2757+
create_cmd = (
2758+
"aks create --resource-group={resource_group} --name={name} --location={location} "
2759+
"--nodepool-name {node_pool_name} --os-sku AzureLinux --node-count 1 --workload-runtime KataVmIsolation "
2760+
"--vm-size Standard_D4s_v3"
2761+
# "--ssh-key-value={ssh_key_value} "
2762+
# '--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview '
2763+
# "--enable-fips-image"
2764+
)
2765+
self.cmd(
2766+
create_cmd,
2767+
checks=[
2768+
self.check("provisioningState", "Succeeded"),
2769+
self.check("agentPoolProfiles[0].enableFips", True),
2770+
],
2771+
)
2772+
2773+
# verify no flag no change
2774+
self.cmd(
2775+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name} "
2776+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview',
2777+
checks=[
2778+
self.check("provisioningState", "Succeeded"),
2779+
self.check("enableFips", True),
2780+
],
2781+
)
2782+
2783+
# verify same update no change
2784+
self.cmd(
2785+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name} "
2786+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview '
2787+
"--enable-fips-image",
2788+
checks=[
2789+
self.check("provisioningState", "Succeeded"),
2790+
self.check("enableFips", True),
2791+
],
2792+
)
2793+
2794+
# update nodepool1 to disable
2795+
self.cmd(
2796+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name} "
2797+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview '
2798+
"--disable-fips-image",
2799+
checks=[
2800+
self.check("provisioningState", "Succeeded"),
2801+
self.check("enableFips", False),
2802+
],
2803+
)
2804+
2805+
# 2. add nodepool2
2806+
self.cmd(
2807+
"aks nodepool add "
2808+
"--resource-group={resource_group} "
2809+
"--cluster-name={name} "
2810+
"--name={node_pool_name_second} "
2811+
"--os-type Linux "
2812+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview ',
2813+
checks=[
2814+
self.check("provisioningState", "Succeeded"),
2815+
self.check("enableFips", False),
2816+
],
2817+
)
2818+
2819+
# verify no flag no change
2820+
self.cmd(
2821+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name_second} "
2822+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview',
2823+
checks=[
2824+
self.check("provisioningState", "Succeeded"),
2825+
self.check("enableFips", False),
2826+
],
2827+
)
2828+
2829+
# verify same update no change
2830+
self.cmd(
2831+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name_second} "
2832+
'--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview '
2833+
"--disable-fips-image",
2834+
checks=[
2835+
self.check("provisioningState", "Succeeded"),
2836+
self.check("enableFips", False),
2837+
],
2838+
)
2839+
2840+
# update nodepool2 to enable
2841+
self.cmd(
2842+
"aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={node_pool_name_second} "
2843+
"--nodepool-name {node_pool_name} --os-sku AzureLinux --node-count 1 --workload-runtime KataVmIsolation "
2844+
"--vm-size Standard_D4s_v3"
2845+
# '--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/MutableFipsPreview '
2846+
# "--enable-fips-image",
2847+
checks=[
2848+
self.check("provisioningState", "Succeeded"),
2849+
self.check("enableFips", True),
2850+
],
2851+
)
2852+
2853+
# delete
2854+
self.cmd(
2855+
"aks delete -g {resource_group} -n {name} --yes --no-wait",
2856+
checks=[self.is_empty()],
2857+
)
27332858

27342859
@AllowLargeResponse()
27352860
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')

0 commit comments

Comments
 (0)