Skip to content

Commit

Permalink
[AKS] Add option Windows2019, Windows2022 to --os-sku for `az a…
Browse files Browse the repository at this point in the history
…ks nodepool add` (#4549)
  • Loading branch information
ShiqianTao authored May 12, 2022
1 parent 96d66fd commit de8d2e1
Show file tree
Hide file tree
Showing 9 changed files with 1,367 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

0.5.68
++++++
* Add option `Windows2019`, `Windows2022` to `--os-sku` for `az aks nodepool add`.

0.5.67
+++++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"test_aks_create_with_crg_id",
"test_aks_create_and_update_with_http_proxy_config",
"test_aks_snapshot",
"test_aks_custom_kubelet_identity"
"test_aks_custom_kubelet_identity",
"test_aks_nodepool_add_with_ossku_windows2022"
]
}
}
20 changes: 17 additions & 3 deletions src/aks-preview/azext_aks_preview/_completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW

from ._consts import (
CONST_OS_SKU_UBUNTU,
CONST_OS_SKU_CBLMARINER,
CONST_OS_SKU_WINDOWS2019,
CONST_OS_SKU_WINDOWS2022,
)


@Completer
def get_k8s_upgrades_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
Expand Down Expand Up @@ -63,10 +70,17 @@ def get_vm_sizes(cli_ctx, location):


@Completer
def get_ossku_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
"""Return the list of allowed os-sku values"""
def get_cluster_ossku_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
"""Return the list of allowed os-sku values when create cluster"""

return [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER]


@Completer
def get_nodepool_ossku_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
"""Return the list of allowed os-sku values when add nodepool"""

return ["Ubuntu", "CBLMariner"]
return [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_WINDOWS2019, CONST_OS_SKU_WINDOWS2022]


def _get_location(cli_ctx, namespace):
Expand Down
2 changes: 2 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
# os sku
CONST_OS_SKU_UBUNTU = "Ubuntu"
CONST_OS_SKU_CBLMARINER = "CBLMariner"
CONST_OS_SKU_WINDOWS2019 = "Windows2019"
CONST_OS_SKU_WINDOWS2022 = "Windows2022"

# vm set type
CONST_VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets"
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@
short-summary: The OS Type. Linux or Windows.
- name: --os-sku
type: string
short-summary: The os-sku of the agent node pool. Ubuntu or CBLMariner.
short-summary: The os-sku of the agent node pool. Ubuntu or CBLMariner when os-type is Linux, default is Ubuntu if not set; Windows2019 or Windows2022 when os-type is Windows, the current default is Windows2019 if not set, and the default will be changed to Windows2022 after Windows2019 is deprecated.
- name: --enable-fips-image
type: bool
short-summary: Use FIPS-enabled OS on agent nodes.
Expand Down
11 changes: 7 additions & 4 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from ._completers import (
get_k8s_upgrades_completion_list,
get_k8s_versions_completion_list,
get_ossku_completion_list,
get_cluster_ossku_completion_list,
get_nodepool_ossku_completion_list,
get_vm_size_completion_list,
)
from ._consts import (
Expand All @@ -48,6 +49,8 @@
CONST_OS_DISK_TYPE_MANAGED,
CONST_OS_SKU_CBLMARINER,
CONST_OS_SKU_UBUNTU,
CONST_OS_SKU_WINDOWS2019,
CONST_OS_SKU_WINDOWS2022,
CONST_OUTBOUND_TYPE_LOAD_BALANCER,
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY,
Expand Down Expand Up @@ -116,7 +119,7 @@
node_eviction_policies = [CONST_SPOT_EVICTION_POLICY_DELETE, CONST_SPOT_EVICTION_POLICY_DEALLOCATE]
node_os_disk_types = [CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL]
node_mode_types = [CONST_NODEPOOL_MODE_SYSTEM, CONST_NODEPOOL_MODE_USER]
node_os_skus = [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER]
node_os_skus = [CONST_OS_SKU_UBUNTU, CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_WINDOWS2019, CONST_OS_SKU_WINDOWS2022]
scale_down_modes = [CONST_SCALE_DOWN_MODE_DELETE, CONST_SCALE_DOWN_MODE_DEALLOCATE]
workload_runtimes = [CONST_WORKLOAD_RUNTIME_OCI_CONTAINER, CONST_WORKLOAD_RUNTIME_WASM_WASI]
gpu_instance_profiles = [
Expand Down Expand Up @@ -243,7 +246,7 @@ def load_arguments(self, _):
help='Node pool name, upto 12 alphanumeric characters', validator=validate_nodepool_name)
c.argument('node_vm_size', options_list=[
'--node-vm-size', '-s'], completer=get_vm_size_completion_list)
c.argument('os_sku', completer=get_ossku_completion_list)
c.argument('os_sku', completer=get_cluster_ossku_completion_list)
c.argument('vnet_subnet_id', validator=validate_vnet_subnet_id)
c.argument('pod_subnet_id', validator=validate_pod_subnet_id)
c.argument('enable_node_public_ip', action='store_true')
Expand Down Expand Up @@ -411,7 +414,7 @@ def load_arguments(self, _):
'--node-vm-size', '-s'], completer=get_vm_size_completion_list)
c.argument('os_type')
c.argument('os_sku', options_list=[
'--os-sku'], completer=get_ossku_completion_list)
'--os-sku'], completer=get_nodepool_ossku_completion_list)
c.argument('vnet_subnet_id',
validator=validate_vnet_subnet_id)
c.argument('pod_subnet_id',
Expand Down
Loading

0 comments on commit de8d2e1

Please sign in to comment.