Skip to content
6 changes: 6 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
CONST_SPOT_EVICTION_POLICY_DELETE = "Delete"
CONST_SPOT_EVICTION_POLICY_DEALLOCATE = "Deallocate"

# consts for upgrade channel
CONST_RAPID_UPGRADE_CHANNEL = "rapid"
CONST_STABLE_UPGRADE_CHANNEL = "stable"
CONST_PATCH_UPGRADE_CHANNEL = "patch"
CONST_NONE_UPGRADE_CHANNEL = "none"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these values defined in the swagger and have been defined as Enum in the SDK ? If yes, we may be able to leverage it instead of defining separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they are defined in the swagger, however, consts file does depend on the versioned SDK, not sure if it's the reason that we are defining these consts here (don't want to introduce dependency?). Probably I am going to break the pattern and keep it consistent for now. :)


CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME = "httpApplicationRouting"

CONST_MONITORING_ADDON_NAME = "omsagent"
Expand Down
6 changes: 6 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@
- name: --disable-sgxquotehelper
type: bool
short-summary: Disable SGX quote helper for confcom addon.
- name: --auto-upgrade-channel
type: string
short-summary: Specify the upgrade channel for autoupgrade. It could be rapid, stable, patch or none, none means disable autoupgrade.
- name: --kubelet-config
type: string
short-summary: Kubelet configurations for agent nodes.
Expand Down Expand Up @@ -428,6 +431,9 @@
- name: --aks-custom-headers
type: string
short-summary: Send custom headers. When specified, format should be Key1=Value1,Key2=Value2
- name: --auto-upgrade-channel
type: string
short-summary: Specify the upgrade channel for autoupgrade. It could be rapid, stable, patch or none, none means disable autoupgrade.
- name: --enable-managed-identity
type: bool
short-summary: (PREVIEW) Update current cluster to managed identity to manage cluster resource group.
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
CONST_SPOT_EVICTION_POLICY_DELETE, CONST_SPOT_EVICTION_POLICY_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_NONE_UPGRADE_CHANNEL, \
CONST_PRIVATE_DNS_ZONE_SYSTEM, CONST_PRIVATE_DNS_ZONE_NONE


Expand Down Expand Up @@ -110,6 +111,7 @@ def load_arguments(self, _):
c.argument('enable_managed_identity', action='store_true')
c.argument('assign_identity', type=str, validator=validate_assign_identity)
c.argument('disable_sgxquotehelper', action='store_true')
c.argument('auto_upgrade_channel', arg_type=get_enum_type([CONST_RAPID_UPGRADE_CHANNEL, CONST_STABLE_UPGRADE_CHANNEL, CONST_PATCH_UPGRADE_CHANNEL, CONST_NONE_UPGRADE_CHANNEL]))
c.argument('kubelet_config', type=str)
c.argument('linux_os_config', type=str)

Expand All @@ -132,6 +134,7 @@ def load_arguments(self, _):
c.argument('attach_acr', acr_arg_type, validator=validate_acr)
c.argument('detach_acr', acr_arg_type, validator=validate_acr)
c.argument('aks_custom_headers')
c.argument('auto_upgrade_channel', arg_type=get_enum_type([CONST_RAPID_UPGRADE_CHANNEL, CONST_STABLE_UPGRADE_CHANNEL, CONST_PATCH_UPGRADE_CHANNEL, CONST_NONE_UPGRADE_CHANNEL]))
c.argument('enable_managed_identity', action='store_true')
c.argument('assign_identity', type=str, validator=validate_assign_identity)
c.argument('yes', options_list=['--yes', '-y'], help='Do not prompt for confirmation.', action='store_true')
Expand Down
20 changes: 18 additions & 2 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
ManagedClusterAPIServerAccessProfile,
ManagedClusterSKU,
ManagedClusterIdentityUserAssignedIdentitiesValue,
ManagedClusterAutoUpgradeProfile,
KubeletConfig,
LinuxOSConfig,
SysctlConfig)
Expand Down Expand Up @@ -882,6 +883,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
kubelet_config=None,
linux_os_config=None,
assign_identity=None,
auto_upgrade_channel=None,
no_wait=False):
if not no_ssh_key:
try:
Expand Down Expand Up @@ -1123,6 +1125,10 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
if disable_rbac:
enable_rbac = False

auto_upgrade_profile = None
if auto_upgrade_channel is not None:
auto_upgrade_profile = ManagedClusterAutoUpgradeProfile(upgrade_channel=auto_upgrade_channel)

mc = ManagedCluster(
location=location, tags=tags,
dns_prefix=dns_name_prefix,
Expand All @@ -1139,7 +1145,8 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to
enable_pod_security_policy=bool(enable_pod_security_policy),
identity=identity,
disk_encryption_set_id=node_osdisk_diskencryptionset_id,
api_server_access_profile=api_server_access_profile)
api_server_access_profile=api_server_access_profile,
auto_upgrade_profile=auto_upgrade_profile)

if node_resource_group:
mc.node_resource_group = node_resource_group
Expand Down Expand Up @@ -1256,6 +1263,7 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
enable_ahub=False,
disable_ahub=False,
aks_custom_headers=None,
auto_upgrade_channel=None,
enable_managed_identity=False,
assign_identity=None,
yes=False):
Expand All @@ -1281,6 +1289,7 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
not update_aad_profile and \
not enable_ahub and \
not disable_ahub and \
not auto_upgrade_channel and \
not enable_managed_identity and \
not assign_identity:
raise CLIError('Please specify "--enable-cluster-autoscaler" or '
Expand All @@ -1300,7 +1309,8 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
'"--aad-tenant-id" or '
'"--aad-admin-group-object-ids" or '
'"--enable-ahub" or '
'"--disable-ahub" or'
'"--disable-ahub" or '
'"--auto-upgrade-channel" or '
'"--enable-managed-identity"')

instance = client.get(resource_group_name, name)
Expand Down Expand Up @@ -1437,6 +1447,12 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
if disable_ahub:
instance.windows_profile.license_type = 'None'

if instance.auto_upgrade_profile is None:
instance.auto_upgrade_profile = ManagedClusterAutoUpgradeProfile()

if auto_upgrade_channel is not None:
instance.auto_upgrade_profile.upgrade_channel = auto_upgrade_channel

if not enable_managed_identity and assign_identity:
raise CLIError('--assign-identity can only be specified when --enable-managed-identity is specified')

Expand Down
Loading