Skip to content

Commit

Permalink
add workload runtime support for aks (#3896)
Browse files Browse the repository at this point in the history
* wip wasm

* don't run live tests due to feature registration

* fix: typos, align consts, rerecord test.

* history: bump version for new features

* bump version in setup.py
  • Loading branch information
alexeldeib authored Sep 29, 2021
1 parent 5a16a5d commit 33ec455
Show file tree
Hide file tree
Showing 9 changed files with 1,191 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/aks-preview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
0.5.34
+++++
* Add support for WASM nodepools (`--workload-runtime WasmWasi`) in `az aks create`
and `az aks nodepool add`

0.5.33
+++++
* Add support for new addon commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"test_aks_enable_monitoring_with_aad_auth_msi",
"test_aks_enable_monitoring_with_aad_auth_uai",
"test_aks_create_and_update_with_managed_nat_gateway_outbound",
"test_aks_create_with_http_proxy_config"
"test_aks_create_with_http_proxy_config",
"test_aks_nodepool_add_with_workload_runtime"
]
}
}
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@
CONST_AZURE_KEYVAULT_SECRETS_PROVIDER_ADDON_NAME: '- enable Azure Keyvault Secrets Provider addon (PREVIEW).'
}

CONST_WORKLOAD_RUNTIME_OCI_CONTAINER = "OCIContainer"
CONST_WORKLOAD_RUNTIME_WASM_WASI = "WasmWasi"

CONST_MANAGED_IDENTITY_OPERATOR_ROLE = 'Managed Identity Operator'
CONST_MANAGED_IDENTITY_OPERATOR_ROLE_ID = 'f1a07417-d97a-45cb-824c-7a7467783830'
10 changes: 9 additions & 1 deletion src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@
- name: --disable-local-accounts
type: bool
short-summary: (Preview) If set to true, getting static credential will be disabled for this cluster.
- name: --workload-runtime
type: string
short-summary: Determines the type of workload a node can run. Defaults to OCIContainer.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
Expand Down Expand Up @@ -936,13 +939,18 @@
- name: --enable-ultra-ssd
type: bool
short-summary: Enable UltraSSD on agent node pool.
- name: --workload-runtime
type: string
short-summary: Determines the type of workload a node can run. Defaults to OCIContainer.
examples:
- name: Create a nodepool in an existing AKS cluster with ephemeral os enabled.
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --node-osdisk-type Ephemeral --node-osdisk-size 48
- name: Create a nodepool with EncryptionAtHost enabled.
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --enable-encryption-at-host
- name: Create a nodepool cluster with a specific os-sku
- name: Create a nodepool with a specific os-sku
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --os-sku Ubuntu
- name: Create a nodepool which can run wasm workloads.
text: az aks nodepool add -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --workload-runtime WasmWasi
"""

helps['aks nodepool scale'] = """
Expand Down
7 changes: 6 additions & 1 deletion src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
CONST_SCALE_DOWN_MODE_DELETE, CONST_SCALE_DOWN_MODE_DEALLOCATE, \
CONST_NODEPOOL_MODE_SYSTEM, CONST_NODEPOOL_MODE_USER, \
CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL, \
CONST_RAPID_UPGRADE_CHANNEL, CONST_STABLE_UPGRADE_CHANNEL, CONST_PATCH_UPGRADE_CHANNEL, CONST_NODE_IMAGE_UPGRADE_CHANNEL, CONST_NONE_UPGRADE_CHANNEL
CONST_RAPID_UPGRADE_CHANNEL, CONST_STABLE_UPGRADE_CHANNEL, CONST_PATCH_UPGRADE_CHANNEL, CONST_NODE_IMAGE_UPGRADE_CHANNEL, CONST_NONE_UPGRADE_CHANNEL, \
CONST_WORKLOAD_RUNTIME_OCI_CONTAINER, CONST_WORKLOAD_RUNTIME_WASM_WASI

workload_runtimes = [CONST_WORKLOAD_RUNTIME_OCI_CONTAINER, CONST_WORKLOAD_RUNTIME_WASM_WASI]


def load_arguments(self, _):
Expand Down Expand Up @@ -141,6 +144,7 @@ def load_arguments(self, _):
c.argument('assign_kubelet_identity', type=str, validator=validate_assign_kubelet_identity)
c.argument('disable_local_accounts', action='store_true')
c.argument('yes', options_list=['--yes', '-y'], help='Do not prompt for confirmation.', action='store_true')
c.argument('workload_runtime', arg_type=get_enum_type(workload_runtimes), default=CONST_WORKLOAD_RUNTIME_OCI_CONTAINER)

with self.argument_context('aks update') as c:
c.argument('enable_cluster_autoscaler', options_list=["--enable-cluster-autoscaler", "-e"], action='store_true')
Expand Down Expand Up @@ -233,6 +237,7 @@ def load_arguments(self, _):
c.argument('linux_os_config', type=str)
c.argument('enable_encryption_at_host', options_list=['--enable-encryption-at-host'], action='store_true')
c.argument('enable_ultra_ssd', action='store_true')
c.argument('workload_runtime', arg_type=get_enum_type(workload_runtimes), default=CONST_WORKLOAD_RUNTIME_OCI_CONTAINER)

for scope in ['aks nodepool show', 'aks nodepool delete', 'aks nodepool scale', 'aks nodepool upgrade', 'aks nodepool update']:
with self.argument_context(scope) as c:
Expand Down
8 changes: 6 additions & 2 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
disable_local_accounts=False,
no_wait=False,
assign_kubelet_identity=None,
workload_runtime=None,
yes=False):
if not no_ssh_key:
try:
Expand Down Expand Up @@ -868,7 +869,8 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
enable_encryption_at_host=enable_encryption_at_host,
enable_ultra_ssd=enable_ultra_ssd,
max_pods=int(max_pods) if max_pods else None,
type=vm_set_type
type=vm_set_type,
workload_runtime=workload_runtime
)

if node_osdisk_size:
Expand Down Expand Up @@ -2375,6 +2377,7 @@ def aks_agentpool_add(cmd, # pylint: disable=unused-argument,too-many-local
linux_os_config=None,
enable_encryption_at_host=False,
enable_ultra_ssd=False,
workload_runtime=None,
no_wait=False):
instances = client.list(resource_group_name, cluster_name)
for agentpool_profile in instances:
Expand Down Expand Up @@ -2428,7 +2431,8 @@ def aks_agentpool_add(cmd, # pylint: disable=unused-argument,too-many-local
upgrade_settings=upgradeSettings,
enable_encryption_at_host=enable_encryption_at_host,
enable_ultra_ssd=enable_ultra_ssd,
mode=mode
mode=mode,
workload_runtime=workload_runtime
)

if priority == CONST_SCALE_SET_PRIORITY_SPOT:
Expand Down
Loading

0 comments on commit 33ec455

Please sign in to comment.