Skip to content

Commit

Permalink
[ACS] az aks create/update: Add parameter --auto-upgrade-channel
Browse files Browse the repository at this point in the history
…to support auto upgrade (#18825)

* implementedCodeFromPreviousPRs

* adding ManagedClusterAutoUpgradeProfile code

* adding test record

* Fix linter failures (#19116) (#19147)

Co-authored-by: Yishi Wang <[email protected]>

* Handle unsupported and no_effect change types (#19144)

* [Batch] Upgrade api-version to v2021-06-01 (#19100)

* Improve nodepool help text for OS Disk options (#19073)

* {AKS} Refactor acs module: add test cases for sub-command `create` (#19026)

* add test for autoscaler

* add test for loadbalancer

* add test for node public ip

* add test for network cidr

* update create default test

* add test for create attach acr

* add AKSCustomRoleBasedServicePrincipalPreparer

* update test ingress appgw

* add test case for outbound type udr

* add test for node_osdisk_diskencryptionset

* add test for enable-encryption-at-host, enable-azure-rbac, disable-rbac and dns-service-ip

* add test for workspace-resource-id

* add recordings

* update recordings

* [SQL] az sql mi update: Add --subnet and --vnet-name parameters to support the cross subnet update SLO (#18886)

* Update sql track2

* Update commands.py

update begin_delete

* update setter_name to pass sdk validation

* replace_all_delete

* pass az self-check

* update recording tests

* fix all begin_xyz issue

* run test to unblock some issues

* pass SqlServerMSSupportScenarioTest

* change region to pass tests

* pass LTR test

* add recorded tests for MI

* update db_rename parameters

* pass db management tests

* address aad tests

* pass sql server aad

* revert azure-mgmt-netapp version change

* record test after rebase

* add three passed tests

* modify short term policy

* complete another three tests

* pass tde test

* pass two more tests

* Update custom.py

* pass two more tests

* pass classification test

* pass long and short backup

* update test file to match new config

* pass server and db security tests

* record test_sql_db_sensitivity_classifications again

* update MI tests

* pass MI tests

* pass tests

* modify instance_pool_test

* Iteration 1:
- Adding support for cross subnet update SLO

* Iteration 2:
- Removing the change from History.rst file

* Iteration 3:
- Fixing merge errors

* Iteration 4:
- Removing merge errors

* Iteration 5:
- Removing merge errors

* Iteration 6:
- Fixed merge errors

* Iteration 7:
- Fix merge errors

* Iteration 7:
- Fixed CLI style issue - removed two trailing spaces
- Fixed CLI linter issue - fixed the cross-subnet update slo command in _help.py

Co-authored-by: Ji Wang <[email protected]>
Co-authored-by: Nemanja <[email protected]>

* [ACR] `acr create/update`: Add new parameter `--allow-exports` to support export (#19065)

* Update azure-mgmt-containerregistry from 8.0.0 to 8.1.0. Add support for export disable.

* Add acr export policy tests

style fix

* re-record acr dependent tests

* style: disable too many locals

* fix style issue

Co-authored-by: Tosin Adewale <[email protected]>

* Fix linter failures (#19116)

* {Packaging} Drop `mock` library (#19024)

* Upgrades Batch SDKs

* Python Data Plane SDK: 11.0.0
* Python Management Plane SDK: 16.0.0
* Fixes data plane tests

* New `outbound-endpoints` and `list-skus` commands

* `az batch account outbound-endpoints`
* `az batch location list-skus`

* Updates tests and session recordings

* Fixes help linting

Co-authored-by: Ismayil <[email protected]>
Co-authored-by: FumingZhang <[email protected]>
Co-authored-by: v-nestan <[email protected]>
Co-authored-by: Ji Wang <[email protected]>
Co-authored-by: Nemanja <[email protected]>
Co-authored-by: Tosin Adewale <[email protected]>
Co-authored-by: Tosin Adewale <[email protected]>
Co-authored-by: jiasli <[email protected]>
Co-authored-by: Yishi Wang <[email protected]>
Co-authored-by: David Watrous <[email protected]>
Co-authored-by: Shiran Pasternak <[email protected]>

* {Release} Hotfix: Release 2.27.1 (#19187)

* Hotfix for 2.27.1

* Update src/azure-cli/HISTORY.rst

Co-authored-by: Yishi Wang <[email protected]>

Co-authored-by: Yishi Wang <[email protected]>

* change to direct enums

Co-authored-by: Xing Zhou <[email protected]>

* fixing PR comments

* change to auto_upgrade_channels

* test_aks_create_with_auto_upgrade_channel

* Revert "test_aks_create_with_auto_upgrade_channel"

This reverts commit c1affbf.

* Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI"

This reverts commit 4121a33, reversing
changes made to c7f92e3.

* Revert "Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI""

This reverts commit ec9cd69.

* Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI"

This reverts commit 4121a33, reversing
changes made to c7f92e3.

* Revert "Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI""

This reverts commit 0ef331c.

* Revert "Revert "Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI"""

This reverts commit cd47cb0.

* Revert "Revert "Revert "Revert "Merge branch 'master' into charliedmcb/addingAutoupgraderToCLI""""

This reverts commit 8d8f80f.

* Revert "Handle unsupported and no_effect change types (#19144)"

This reverts commit 71456b1.

* Revert "Revert "Handle unsupported and no_effect change types (#19144)""

This reverts commit effe159.

* Revert "{Release} Hotfix: Release 2.27.1 (#19187)"

This reverts commit da3ff65.

* Revert "[Batch] Upgrade api-version to v2021-06-01 (#19100)"

This reverts commit ed4e903.

* Revert "Handle unsupported and no_effect change types (#19144)"

This reverts commit 71456b1.

* running new test

* remove yaml

* ran test

Co-authored-by: Charlie McBride <[email protected]>
Co-authored-by: Xing Zhou <[email protected]>
Co-authored-by: Yishi Wang <[email protected]>
Co-authored-by: Shenglong Li <[email protected]>
Co-authored-by: Rena <[email protected]>
Co-authored-by: Ismayil <[email protected]>
Co-authored-by: FumingZhang <[email protected]>
Co-authored-by: v-nestan <[email protected]>
Co-authored-by: Ji Wang <[email protected]>
Co-authored-by: Nemanja <[email protected]>
Co-authored-by: Tosin Adewale <[email protected]>
Co-authored-by: Tosin Adewale <[email protected]>
Co-authored-by: jiasli <[email protected]>
Co-authored-by: David Watrous <[email protected]>
Co-authored-by: Shiran Pasternak <[email protected]>
  • Loading branch information
16 people authored Aug 18, 2021
1 parent 14cc787 commit 6918b29
Show file tree
Hide file tree
Showing 5 changed files with 1,159 additions and 1 deletion.
6 changes: 6 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 @@ -312,6 +312,9 @@
type: string
short-summary: How outbound traffic will be configured for a cluster.
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.
- name: --auto-upgrade-channel
type: string
short-summary: Specify the upgrade channel for autoupgrade.
- name: --enable-cluster-autoscaler
type: bool
short-summary: Enable cluster autoscaler, default value is false.
Expand Down Expand Up @@ -546,6 +549,9 @@
type: int
short-summary: Load balancer idle timeout in minutes.
long-summary: Desired idle timeout for load balancer outbound flows, default is 30 minutes. Please specify a value in the range of [4, 100].
- name: --auto-upgrade-channel
type: string
short-summary: Specify the upgrade channel for autoupgrade.
- name: --attach-acr
type: string
short-summary: Grant the 'acrpull' role assignment to the ACR specified by name or resource ID.
Expand Down
10 changes: 10 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
"westus",
]

auto_upgrade_channels = [
"rapid",
"stable",
"patch",
"node-image",
"none"
]

storage_profile_types = ["StorageAccount", "ManagedDisks"]
nodepool_mode_type = ["System", "User"]

Expand Down Expand Up @@ -203,6 +211,7 @@ def load_arguments(self, _):
validator=validate_load_balancer_idle_timeout)
c.argument('outbound_type', arg_type=get_enum_type([CONST_OUTBOUND_TYPE_LOAD_BALANCER,
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING]))
c.argument('auto_upgrade_channel', arg_type=get_enum_type(auto_upgrade_channels))
c.argument('enable_cluster_autoscaler', action='store_true')
c.argument('cluster_autoscaler_profile', nargs='+', options_list=["--cluster-autoscaler-profile", "--ca-profile"], validator=validate_cluster_autoscaler_profile,
help="Space-separated list of key=value pairs for configuring cluster autoscaler. Pass an empty string to clear the profile.")
Expand Down Expand Up @@ -296,6 +305,7 @@ def load_arguments(self, _):
validator=validate_load_balancer_outbound_ports)
c.argument('load_balancer_idle_timeout', type=int,
validator=validate_load_balancer_idle_timeout)
c.argument('auto_upgrade_channel', arg_type=get_enum_type(auto_upgrade_channels))
c.argument('api_server_authorized_ip_ranges',
type=str, validator=validate_ip_ranges)
c.argument('enable_ahub', options_list=['--enable-ahub'])
Expand Down
23 changes: 22 additions & 1 deletion src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
load_balancer_outbound_ports=None,
load_balancer_idle_timeout=None,
outbound_type=None,
auto_upgrade_channel=None,
enable_addons=None,
workspace_resource_id=None,
vnet_subnet_id=None,
Expand Down Expand Up @@ -2098,6 +2099,9 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
ManagedClusterAADProfile = cmd.get_models('ManagedClusterAADProfile',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
ManagedClusterAutoUpgradeProfile = cmd.get_models('ManagedClusterAutoUpgradeProfile',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
ManagedClusterAgentPoolProfile = cmd.get_models('ManagedClusterAgentPoolProfile',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
Expand Down Expand Up @@ -2428,6 +2432,10 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
cluster_identity_object_id,
assign_kubelet_identity)

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,
Expand All @@ -2445,7 +2453,8 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
api_server_access_profile=api_server_access_profile,
identity=identity,
disk_encryption_set_id=node_osdisk_diskencryptionset_id,
identity_profile=identity_profile
identity_profile=identity_profile,
auto_upgrade_profile=auto_upgrade_profile
)

use_custom_private_dns_zone = False
Expand Down Expand Up @@ -2753,6 +2762,7 @@ def aks_update(cmd, client, resource_group_name, name,
enable_ahub=False,
disable_ahub=False,
windows_admin_password=None,
auto_upgrade_channel=None,
enable_managed_identity=False,
assign_identity=None,
yes=False,
Expand All @@ -2765,6 +2775,9 @@ def aks_update(cmd, client, resource_group_name, name,
ManagedClusterAADProfile = cmd.get_models('ManagedClusterAADProfile',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
ManagedClusterAutoUpgradeProfile = cmd.get_models('ManagedClusterAutoUpgradeProfile',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
ManagedClusterIdentity = cmd.get_models('ManagedClusterIdentity',
resource_type=ResourceType.MGMT_CONTAINERSERVICE,
operation_group='managed_clusters')
Expand Down Expand Up @@ -2794,6 +2807,7 @@ def aks_update(cmd, client, resource_group_name, name,
not update_aad_profile and
not enable_ahub and
not disable_ahub and
not auto_upgrade_channel and
not windows_admin_password and
not enable_managed_identity and
not assign_identity):
Expand All @@ -2806,6 +2820,7 @@ def aks_update(cmd, client, resource_group_name, name,
'"--load-balancer-outbound-ip-prefixes" or'
'"--load-balancer-outbound-ports" or'
'"--load-balancer-idle-timeout" or'
'"--auto-upgrade-channel" or '
'"--attach-acr" or "--detach-acr" or'
'"--uptime-sla" or'
'"--no-uptime-sla" or '
Expand Down Expand Up @@ -2967,6 +2982,12 @@ def aks_update(cmd, client, resource_group_name, name,
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 windows_admin_password:
instance.windows_profile.admin_password = windows_admin_password

Expand Down
Loading

0 comments on commit 6918b29

Please sign in to comment.