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/azure-cli/azure/cli/command_modules/acs/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

CONST_SPOT_EVICTION_POLICY_DELETE = "Delete"
CONST_SPOT_EVICTION_POLICY_DEALLOCATE = "Deallocate"

CONST_OS_DISK_TYPE_MANAGED = "Managed"
CONST_OS_DISK_TYPE_EPHEMERAL = "Ephemeral"
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,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 'Ephemeral' when possible in conjunction with VM size and OS disk size. May not be changed for this pool after creation.
- name: --kubernetes-version -k
type: string
short-summary: Version of Kubernetes to use for creating the cluster, such as "1.16.9".
Expand Down Expand Up @@ -407,6 +410,8 @@
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 server side encryption using your owned key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-osdisk-diskencryptionset-id <disk-encryption-set-resource-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
"""

helps['aks update'] = """
Expand Down Expand Up @@ -621,6 +626,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 'Ephemeral' when possible in conjunction with VM size and OS disk size. 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 @@ -667,6 +675,9 @@
- name: --spot-max-price
type: float
short-summary: It can only be set when --priority is Spot. Specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. It can only include up to 5 decimal places.
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 delete'] = """
Expand Down
4 changes: 3 additions & 1 deletion src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
validate_load_balancer_outbound_ports, validate_load_balancer_idle_timeout, validate_vnet_subnet_id, validate_nodepool_labels, validate_ppg)
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_SPOT_EVICTION_POLICY_DELETE, CONST_SPOT_EVICTION_POLICY_DEALLOCATE, \
CONST_OS_DISK_TYPE_MANAGED, CONST_OS_DISK_TYPE_EPHEMERAL

orchestrator_types = ["Custom", "DCOS", "Kubernetes", "Swarm", "DockerCE"]

Expand Down Expand Up @@ -297,6 +298,7 @@ def load_arguments(self, _):
c.argument('mode', get_enum_type(nodepool_mode_type))
c.argument('enable_node_public_ip', action='store_true', is_preview=True)
c.argument('ppg', type=str, validator=validate_ppg)
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
11 changes: 8 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
from azure.mgmt.containerservice.v2020_09_01.models import ManagedClusterServicePrincipalProfile
from azure.mgmt.containerservice.v2020_09_01.models import ContainerServiceSshConfiguration
from azure.mgmt.containerservice.v2020_09_01.models import ContainerServiceSshPublicKey
from azure.mgmt.containerservice.v2020_09_01.models import ContainerServiceStorageProfileTypes
from azure.mgmt.containerservice.v2020_09_01.models import ManagedCluster
from azure.mgmt.containerservice.v2020_09_01.models import ManagedClusterAADProfile
from azure.mgmt.containerservice.v2020_09_01.models import ManagedClusterAddonProfile
Expand Down Expand Up @@ -1593,6 +1592,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
enable_ahub=False,
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 @@ -1666,7 +1666,6 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
count=int(node_count),
vm_size=node_vm_size,
os_type="Linux",
storage_profile=ContainerServiceStorageProfileTypes.managed_disks,
vnet_subnet_id=vnet_subnet_id,
proximity_placement_group_id=ppg,
availability_zones=zones,
Expand All @@ -1678,6 +1677,9 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
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 @@ -2904,6 +2906,7 @@ def aks_agentpool_add(cmd, client, resource_group_name, cluster_name, nodepool_n
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 @@ -2950,7 +2953,6 @@ def aks_agentpool_add(cmd, client, resource_group_name, cluster_name, nodepool_n
count=int(node_count),
vm_size=node_vm_size,
os_type=os_type,
storage_profile=ContainerServiceStorageProfileTypes.managed_disks,
vnet_subnet_id=vnet_subnet_id,
proximity_placement_group_id=ppg,
agent_pool_type="VirtualMachineScaleSets",
Expand All @@ -2974,6 +2976,9 @@ def aks_agentpool_add(cmd, client, resource_group_name, cluster_name, nodepool_n
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

return sdk_no_wait(no_wait, client.create_or_update, resource_group_name, cluster_name, nodepool_name, agent_pool)


Expand Down
Loading