Skip to content

Commit 8dbfa30

Browse files
authored
[AKS] Revert PR #18825: az aks create/update: Add parameter --auto-upgrade-channel to support auto upgrade (with fix) (#19297)
redo auto upgrade channel change.
1 parent 4181724 commit 8dbfa30

File tree

5 files changed

+962
-1
lines changed

5 files changed

+962
-1
lines changed

src/azure-cli/azure/cli/command_modules/acs/_help.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@
312312
type: string
313313
short-summary: How outbound traffic will be configured for a cluster.
314314
long-summary: Select between loadBalancer and userDefinedRouting. If not set, defaults to type loadBalancer. Requires --vnet-subnet-id to be provided with a preconfigured route table and --load-balancer-sku to be Standard.
315+
- name: --auto-upgrade-channel
316+
type: string
317+
short-summary: Specify the upgrade channel for autoupgrade.
315318
- name: --enable-cluster-autoscaler
316319
type: bool
317320
short-summary: Enable cluster autoscaler, default value is false.
@@ -549,6 +552,9 @@
549552
type: int
550553
short-summary: Load balancer idle timeout in minutes.
551554
long-summary: Desired idle timeout for load balancer outbound flows, default is 30 minutes. Please specify a value in the range of [4, 100].
555+
- name: --auto-upgrade-channel
556+
type: string
557+
short-summary: Specify the upgrade channel for autoupgrade.
552558
- name: --attach-acr
553559
type: string
554560
short-summary: Grant the 'acrpull' role assignment to the ACR specified by name or resource ID.

src/azure-cli/azure/cli/command_modules/acs/_params.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@
6464
"westus",
6565
]
6666

67+
auto_upgrade_channels = [
68+
"rapid",
69+
"stable",
70+
"patch",
71+
"node-image",
72+
"none"
73+
]
74+
6775
storage_profile_types = ["StorageAccount", "ManagedDisks"]
6876
nodepool_mode_type = ["System", "User"]
6977

@@ -203,6 +211,7 @@ def load_arguments(self, _):
203211
validator=validate_load_balancer_idle_timeout)
204212
c.argument('outbound_type', arg_type=get_enum_type([CONST_OUTBOUND_TYPE_LOAD_BALANCER,
205213
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING]))
214+
c.argument('auto_upgrade_channel', arg_type=get_enum_type(auto_upgrade_channels))
206215
c.argument('enable_cluster_autoscaler', action='store_true')
207216
c.argument('cluster_autoscaler_profile', nargs='+', options_list=["--cluster-autoscaler-profile", "--ca-profile"], validator=validate_cluster_autoscaler_profile,
208217
help="Space-separated list of key=value pairs for configuring cluster autoscaler. Pass an empty string to clear the profile.")
@@ -297,6 +306,7 @@ def load_arguments(self, _):
297306
validator=validate_load_balancer_outbound_ports)
298307
c.argument('load_balancer_idle_timeout', type=int,
299308
validator=validate_load_balancer_idle_timeout)
309+
c.argument('auto_upgrade_channel', arg_type=get_enum_type(auto_upgrade_channels))
300310
c.argument('api_server_authorized_ip_ranges',
301311
type=str, validator=validate_ip_ranges)
302312
c.argument('enable_ahub', options_list=['--enable-ahub'])

src/azure-cli/azure/cli/command_modules/acs/custom.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
20362036
load_balancer_outbound_ports=None,
20372037
load_balancer_idle_timeout=None,
20382038
outbound_type=None,
2039+
auto_upgrade_channel=None,
20392040
enable_addons=None,
20402041
workspace_resource_id=None,
20412042
vnet_subnet_id=None,
@@ -2076,6 +2077,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
20762077
no_wait=False,
20772078
yes=False,
20782079
enable_azure_rbac=False):
2080+
auto_upgrade_profile = None
20792081
ManagedClusterWindowsProfile = cmd.get_models('ManagedClusterWindowsProfile',
20802082
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
20812083
operation_group='managed_clusters')
@@ -2100,6 +2102,9 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
21002102
ManagedClusterAADProfile = cmd.get_models('ManagedClusterAADProfile',
21012103
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
21022104
operation_group='managed_clusters')
2105+
ManagedClusterAutoUpgradeProfile = cmd.get_models('ManagedClusterAutoUpgradeProfile',
2106+
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
2107+
operation_group='managed_clusters')
21032108
ManagedClusterAgentPoolProfile = cmd.get_models('ManagedClusterAgentPoolProfile',
21042109
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
21052110
operation_group='managed_clusters')
@@ -2430,6 +2435,9 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
24302435
cluster_identity_object_id,
24312436
assign_kubelet_identity)
24322437

2438+
if auto_upgrade_channel is not None:
2439+
auto_upgrade_profile = ManagedClusterAutoUpgradeProfile(upgrade_channel=auto_upgrade_channel)
2440+
24332441
mc = ManagedCluster(
24342442
location=location,
24352443
tags=tags,
@@ -2447,7 +2455,8 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
24472455
api_server_access_profile=api_server_access_profile,
24482456
identity=identity,
24492457
disk_encryption_set_id=node_osdisk_diskencryptionset_id,
2450-
identity_profile=identity_profile
2458+
identity_profile=identity_profile,
2459+
auto_upgrade_profile=auto_upgrade_profile
24512460
)
24522461

24532462
if disable_public_fqdn:
@@ -2771,6 +2780,7 @@ def aks_update(cmd, client, resource_group_name, name,
27712780
enable_ahub=False,
27722781
disable_ahub=False,
27732782
windows_admin_password=None,
2783+
auto_upgrade_channel=None,
27742784
enable_managed_identity=False,
27752785
assign_identity=None,
27762786
yes=False,
@@ -2785,6 +2795,9 @@ def aks_update(cmd, client, resource_group_name, name,
27852795
ManagedClusterAADProfile = cmd.get_models('ManagedClusterAADProfile',
27862796
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
27872797
operation_group='managed_clusters')
2798+
ManagedClusterAutoUpgradeProfile = cmd.get_models('ManagedClusterAutoUpgradeProfile',
2799+
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
2800+
operation_group='managed_clusters')
27882801
ManagedClusterIdentity = cmd.get_models('ManagedClusterIdentity',
27892802
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
27902803
operation_group='managed_clusters')
@@ -2814,6 +2827,7 @@ def aks_update(cmd, client, resource_group_name, name,
28142827
not update_aad_profile and
28152828
not enable_ahub and
28162829
not disable_ahub and
2830+
not auto_upgrade_channel and
28172831
not windows_admin_password and
28182832
not enable_managed_identity and
28192833
not assign_identity and
@@ -2828,6 +2842,7 @@ def aks_update(cmd, client, resource_group_name, name,
28282842
'"--load-balancer-outbound-ip-prefixes" or'
28292843
'"--load-balancer-outbound-ports" or'
28302844
'"--load-balancer-idle-timeout" or'
2845+
'"--auto-upgrade-channel" or '
28312846
'"--attach-acr" or "--detach-acr" or'
28322847
'"--uptime-sla" or'
28332848
'"--no-uptime-sla" or '
@@ -2991,6 +3006,11 @@ def aks_update(cmd, client, resource_group_name, name,
29913006
if disable_ahub:
29923007
instance.windows_profile.license_type = 'None'
29933008

3009+
if auto_upgrade_channel is not None:
3010+
if instance.auto_upgrade_profile is None:
3011+
instance.auto_upgrade_profile = ManagedClusterAutoUpgradeProfile()
3012+
instance.auto_upgrade_profile.upgrade_channel = auto_upgrade_channel
3013+
29943014
if enable_public_fqdn and disable_public_fqdn:
29953015
raise MutuallyExclusiveArgumentError(
29963016
'Cannot specify "--enable-public-fqdn" and "--disable-public-fqdn" at the same time')

0 commit comments

Comments
 (0)