Skip to content

Commit e80d850

Browse files
committed
Added kata flags.
1 parent a469a8c commit e80d850

5 files changed

Lines changed: 29 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,13 @@
619619
Auto: A standard set of Karpenter NodePools are provisioned.
620620
None: No Karpenter NodePools are provisioned.
621621
WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action.
622+
- name: --workload-runtime
623+
type: string
624+
short-summary: Set the workload runtime.
625+
long-summary: |
626+
Azure provides a different workload-runtime to enable Kata supported workloads in your nodepools. The following values can be specified:
627+
- "KataMshvVmIsolation" for Kata.
628+
622629
examples:
623630
- name: Create a Kubernetes cluster with an existing SSH public key.
624631
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
@@ -702,6 +709,8 @@
702709
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto
703710
- name: Create a kubernetes cluster with auto node provisioning and no default pools.
704711
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-provisioning-mode Auto --node-provisioning-default-pools None
712+
- name: Create a kubernetes cluster with KataMshvVmIsolation enabled.
713+
text: az aks create -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataMshvVmIsolation --node-count 1
705714
"""
706715

707716
helps["aks update"] = """
@@ -1806,6 +1815,13 @@
18061815
- name: --gateway-prefix-size
18071816
type: int
18081817
short-summary: The size of Public IPPrefix attached to the Gateway-mode node pool. The node pool must be in Gateway mode.
1818+
- name: --workload-runtime
1819+
type: string
1820+
short-summary: Set the workload runtime.
1821+
long-summary: |
1822+
Azure provides a different workload-runtime to enable Kata supported workloads in your nodepools. The following values can be specified:
1823+
- "KataMshvVmIsolation" for Kata.
1824+
18091825
examples:
18101826
- name: Create a nodepool in an existing AKS cluster with ephemeral os enabled.
18111827
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --node-osdisk-type Ephemeral --node-osdisk-size 48
@@ -1827,6 +1843,8 @@
18271843
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --os-sku Ubuntu --pod-subnet-id /subscriptions/SubID/resourceGroups/AnotherResourceGroup/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/MySubnet --pod-ip-allocation-mode StaticBlock
18281844
- name: create a nodepool of type VirtualMachines
18291845
text: az aks nodepool add -g MyResourceGroup -n MyNodePool --cluster-name MyMC --vm-set-type VirtualMachines --vm-sizes "VMSize1,VMSize2" --node-count 3
1846+
- name: Create a kubernetes cluster with KataMshvVmIsolation enabled.
1847+
text: az aks nodepool add -g MyResourceGroup -n MyManagedCluster --os-sku AzureLinux --vm-size Standard_D4s_v3 --workload-runtime KataMshvVmIsolation --node-count 1
18301848
"""
18311849

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

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@
328328
CONST_APP_ROUTING_NONE_NGINX
329329
]
330330

331+
workload_runtime_types = [
332+
CONST_KATA_MSHV_VM_ISOLATION,
333+
]
334+
331335

332336
def load_arguments(self, _):
333337
acr_arg_type = CLIArgumentType(metavar='ACR_NAME_OR_RESOURCE_ID')
@@ -508,6 +512,7 @@ def load_arguments(self, _):
508512
c.argument('gpu_instance_profile', arg_type=get_enum_type(gpu_instance_profiles))
509513
c.argument('nodepool_allowed_host_ports', nargs='+', validator=validate_allowed_host_ports, help="allowed host ports for agentpool")
510514
c.argument('nodepool_asg_ids', nargs='+', validator=validate_application_security_groups, help="application security groups for agentpool")
515+
c.argument('workload_runtime', arg_type=get_enum_type(workload_runtime_types))
511516
c.argument("message_of_the_day")
512517

513518
# azure monitor profile
@@ -972,6 +977,7 @@ def load_arguments(self, _):
972977
c.argument("if_none_match")
973978
c.argument('gpu_driver', arg_type=get_enum_type(gpu_driver_install_modes))
974979
c.argument("gateway_prefix_size", type=int, validator=validate_gateway_prefix_size)
980+
c.argument('workload_runtime', arg_type=get_enum_type(workload_runtime_types))
975981

976982
with self.argument_context('aks nodepool update', resource_type=ResourceType.MGMT_CONTAINERSERVICE, operation_group='agent_pools') as c:
977983
c.argument('enable_cluster_autoscaler', options_list=[

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ def aks_create(
761761
crg_id=None,
762762
gpu_instance_profile=None,
763763
message_of_the_day=None,
764+
enable_kata_workload_runtime=False,
764765
# azure service mesh
765766
enable_azure_service_mesh=None,
766767
revision=None,
@@ -2671,6 +2672,7 @@ def aks_agentpool_add(
26712672
asg_ids=None,
26722673
node_public_ip_tags=None,
26732674
disable_windows_outbound_nat=False,
2675+
enable_kata_workload_runtime=False,
26742676
# trusted launch
26752677
enable_vtpm=False,
26762678
enable_secure_boot=False,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,8 @@ def test_aks_create_update_fips_flow(self, resource_group, resource_group_locati
27292729
checks=[self.is_empty()],
27302730
)
27312731

2732+
# TODO(mheberling): Add kata tests
2733+
27322734
@AllowLargeResponse()
27332735
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')
27342736
@AKSCustomRoleBasedServicePrincipalPreparer()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6291,6 +6291,7 @@ def test_set_up_agentpool_profile(self):
62916291
"enable_encryption_at_host": True,
62926292
"enable_ultra_ssd": True,
62936293
"enable_fips_image": True,
6294+
# TODO(mheberling): Add kata?
62946295
"message_of_the_day": get_test_data_file_path("invalidconfig.json"),
62956296
"kubelet_config": None,
62966297
"linux_os_config": None,

0 commit comments

Comments
 (0)