Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -14,6 +14,9 @@

CONST_KUBE_DASHBOARD_ADDON_NAME = "kubeDashboard"

CONST_OS_DISK_TYPE_MANAGED = "Managed"
CONST_OS_DISK_TYPE_EPHEMERAL = "Ephemeral"

# IngressApplicaitonGateway configuration keys
CONST_INGRESS_APPGW_ADDON_NAME = "IngressApplicationGateway"
CONST_INGRESS_APPGW_APPLICATION_GATEWAY_NAME = "applicationGatewayName"
Expand Down
12 changes: 12 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
- name: --node-osdisk-size
type: int
short-summary: Size in GB of the OS disk for each node in the node pool. Minimum 30 GB.
- name: --node-osdisk-type
type: string
short-summary: OS disk type to be used for machines in a given agent pool. Defaults to 'Managed'. May not be changed for this pool after creation.
- name: --node-osdisk-diskencryptionset-id
type: string
short-summary: ResourceId of the disk encryption set to use for enabling encryption at rest.
Expand Down Expand Up @@ -278,6 +281,8 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --outbound-type userDefinedRouting --load-balancer-sku standard --vnet-subnet-id customUserSubnetVnetID
- name: Create a kubernetes cluster with managed AAD enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-aad --aad-admin-group-object-ids <id-1,id-2> --aad-tenant-id <id>
- name: Create a kubernetes cluster with ephemeral os enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-osdisk-type Ephemeral --node-osdisk-size 48

""".format(sp_cache=AKS_SERVICE_PRINCIPAL_CACHE)

Expand Down Expand Up @@ -497,6 +502,9 @@
- name: --node-osdisk-size
type: int
short-summary: Size in GB of the OS disk for each node in the agent pool. Minimum 30 GB.
- name: --node-osdisk-type
type: string
short-summary: OS disk type to be used for machines in a given agent pool. Defaults to 'Managed'. May not be changed for this pool after creation.
- name: --max-pods -m
type: int
short-summary: The maximum number of pods deployable to a node.
Expand Down Expand Up @@ -549,6 +557,10 @@
- name: --max-surge
type: string
short-summary: Extra nodes used to speed upgrade. When specified, it represents the number or percent used, eg. 5 or 33%
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

"""

helps['aks nodepool scale'] = """
Expand Down
4 changes: 3 additions & 1 deletion src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from ._consts import CONST_OUTBOUND_TYPE_LOAD_BALANCER, \
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING, CONST_SCALE_SET_PRIORITY_REGULAR, CONST_SCALE_SET_PRIORITY_SPOT, \
CONST_SPOT_EVICTION_POLICY_DELETE, CONST_SPOT_EVICTION_POLICY_DEALLOCATE, \
CONST_NODEPOOL_MODE_SYSTEM, CONST_NODEPOOL_MODE_USER
CONST_NODEPOOL_MODE_SYSTEM, CONST_NODEPOOL_MODE_USER, \
CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL


def load_arguments(self, _):
Expand Down Expand Up @@ -155,6 +156,7 @@ def load_arguments(self, _):
c.argument('aks_custom_headers')
c.argument('ppg')
c.argument('max_surge', type=str, validator=validate_max_surge)
c.argument('node_os_disk_type', arg_type=get_enum_type([CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL]))

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
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def validate_addons(namespace):
matches = str(matches)[1:-1]
all_addons = list(ADDONS)
all_addons = str(all_addons)[1:-1]
if len(matches) == 0:
if not matches:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got lint errors on this running python linters as specified by CLI. (len-as-condition, pylint C1801)

seems like that's a bit debatable as far as being preferable itself, though: pylint-dev/pylint#1405 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised CI didn't catch that

raise CLIError(
f"The addon \"{addon_arg}\" is not a recognized addon option. Possible options: {all_addons}")

Expand Down
10 changes: 9 additions & 1 deletion src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import uuid
import base64
import webbrowser
from math import isnan
from six.moves.urllib.request import urlopen # pylint: disable=import-error
from six.moves.urllib.error import URLError # pylint: disable=import-error
from math import isnan
import requests
from knack.log import get_logger
from knack.util import CLIError
Expand Down Expand Up @@ -789,6 +789,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
windows_admin_password=None,
kubernetes_version='',
node_vm_size="Standard_DS2_v2",
node_osdisk_type=None,
node_osdisk_size=0,
node_osdisk_diskencryptionset_id=None,
node_count=3,
Expand Down Expand Up @@ -900,6 +901,9 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
if node_osdisk_size:
agent_pool_profile.os_disk_size_gb = int(node_osdisk_size)

if node_osdisk_type:
agent_pool_profile.os_disk_type = node_osdisk_type

_check_cluster_autoscaler_flag(enable_cluster_autoscaler, min_count, max_count, node_count, agent_pool_profile)

linux_profile = None
Expand Down Expand Up @@ -2199,6 +2203,7 @@ def aks_agentpool_add(cmd, # pylint: disable=unused-argument,too-many-local
node_zones=None,
enable_node_public_ip=False,
node_vm_size=None,
node_osdisk_type=None,
node_osdisk_size=0,
node_count=3,
vnet_subnet_id=None,
Expand Down Expand Up @@ -2275,6 +2280,9 @@ def aks_agentpool_add(cmd, # pylint: disable=unused-argument,too-many-local
if node_osdisk_size:
agent_pool.os_disk_size_gb = int(node_osdisk_size)

if node_osdisk_type:
agent_pool.os_disk_type = node_osdisk_type

headers = get_aks_custom_headers(aks_custom_headers)
return sdk_no_wait(no_wait, client.create_or_update, resource_group_name, cluster_name, nodepool_name, agent_pool, custom_headers=headers)

Expand Down
Loading