-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute] add VMSS Rolling Upgrade opt #17580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -757,7 +757,10 @@ def build_vmss_resource(cmd, name, naming_prefix, location, tags, overprovision, | |
| terminate_notification_time=None, max_price=None, scale_in_policy=None, | ||
| os_disk_encryption_set=None, data_disk_encryption_sets=None, | ||
| data_disk_iops=None, data_disk_mbps=None, automatic_repairs_grace_period=None, | ||
| specialized=None, os_disk_size_gb=None, encryption_at_host=None, host_group=None): | ||
| specialized=None, os_disk_size_gb=None, encryption_at_host=None, host_group=None, | ||
| max_batch_instance_percent=None, max_unhealthy_instance_percent=None, | ||
| max_unhealthy_upgraded_instance_percent=None, pause_time_between_batches=None, | ||
| enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None): | ||
|
|
||
| # Build IP configuration | ||
| ip_configuration = { | ||
|
|
@@ -915,7 +918,15 @@ def build_vmss_resource(cmd, name, naming_prefix, location, tags, overprovision, | |
| vmss_properties = { | ||
| 'overprovision': overprovision, | ||
| 'upgradePolicy': { | ||
| 'mode': upgrade_policy_mode | ||
| 'mode': upgrade_policy_mode, | ||
| 'rollingUpgradePolicy': { | ||
| 'maxBatchInstancePercent': max_batch_instance_percent, | ||
| 'maxUnhealthyInstancePercent': max_unhealthy_instance_percent, | ||
| 'maxUnhealthyUpgradedInstancePercent': max_unhealthy_upgraded_instance_percent, | ||
| 'pauseTimeBetweenBatches': pause_time_between_batches, | ||
| 'enableCrossZoneUpgrade': enable_cross_zone_upgrade, | ||
| 'prioritizeUnhealthyInstances': prioritize_unhealthy_instances | ||
| } | ||
|
Comment on lines
+921
to
+929
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they are all not specified, do we need to set these
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to my test, |
||
| }, | ||
| 'virtualMachineProfile': { | ||
| 'storageProfile': storage_properties, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2419,7 +2419,9 @@ def create_vmss(cmd, vmss_name, resource_group_name, image=None, | |
| max_price=None, computer_name_prefix=None, orchestration_mode='Uniform', scale_in_policy=None, | ||
| os_disk_encryption_set=None, data_disk_encryption_sets=None, data_disk_iops=None, data_disk_mbps=None, | ||
| automatic_repairs_grace_period=None, specialized=None, os_disk_size_gb=None, encryption_at_host=None, | ||
| host_group=None): | ||
| host_group=None, max_batch_instance_percent=None, max_unhealthy_instance_percent=None, | ||
| max_unhealthy_upgraded_instance_percent=None, pause_time_between_batches=None, | ||
| enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None): | ||
| from azure.cli.core.commands.client_factory import get_subscription_id | ||
| from azure.cli.core.util import random_string, hash_string | ||
| from azure.cli.core.commands.arm import ArmTemplateBuilder | ||
|
|
@@ -2654,7 +2656,11 @@ def _get_public_ip_address_allocation(value, sku): | |
| data_disk_encryption_sets=data_disk_encryption_sets, data_disk_iops=data_disk_iops, | ||
| data_disk_mbps=data_disk_mbps, automatic_repairs_grace_period=automatic_repairs_grace_period, | ||
| specialized=specialized, os_disk_size_gb=os_disk_size_gb, encryption_at_host=encryption_at_host, | ||
| host_group=host_group) | ||
| host_group=host_group, max_batch_instance_percent=max_batch_instance_percent, | ||
| max_unhealthy_instance_percent=max_unhealthy_instance_percent, | ||
| max_unhealthy_upgraded_instance_percent=max_unhealthy_upgraded_instance_percent, | ||
| pause_time_between_batches=pause_time_between_batches, enable_cross_zone_upgrade=enable_cross_zone_upgrade, | ||
| prioritize_unhealthy_instances=prioritize_unhealthy_instances) | ||
|
|
||
| vmss_resource['dependsOn'] = vmss_dependencies | ||
|
|
||
|
|
@@ -2944,7 +2950,10 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False | |
| protect_from_scale_in=None, protect_from_scale_set_actions=None, | ||
| enable_terminate_notification=None, terminate_notification_time=None, ultra_ssd_enabled=None, | ||
| scale_in_policy=None, priority=None, max_price=None, proximity_placement_group=None, | ||
| enable_automatic_repairs=None, automatic_repairs_grace_period=None, **kwargs): | ||
| enable_automatic_repairs=None, automatic_repairs_grace_period=None, max_batch_instance_percent=None, | ||
| max_unhealthy_instance_percent=None, max_unhealthy_upgraded_instance_percent=None, | ||
| pause_time_between_batches=None, enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None, | ||
| **kwargs): | ||
| vmss = kwargs['parameters'] | ||
| aux_subscriptions = None | ||
| # pylint: disable=too-many-boolean-expressions | ||
|
|
@@ -3024,6 +3033,29 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False | |
| if proximity_placement_group is not None: | ||
| vmss.proximity_placement_group = {'id': proximity_placement_group} | ||
|
|
||
| if max_batch_instance_percent is not None or max_unhealthy_instance_percent is not None \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why new condition check? it's better to have comments |
||
| or max_unhealthy_upgraded_instance_percent is not None or pause_time_between_batches is not None \ | ||
| or enable_cross_zone_upgrade is not None or prioritize_unhealthy_instances is not None: | ||
| if vmss.upgrade_policy is None: | ||
| vmss.upgrade_policy = {'rolling_upgrade_policy': None} | ||
| if vmss.upgrade_policy.rolling_upgrade_policy is None: | ||
| vmss.upgrade_policy.rolling_upgrade_policy = { | ||
| 'maxBatchInstancePercent': max_batch_instance_percent, | ||
| 'maxUnhealthyInstancePercent': max_unhealthy_instance_percent, | ||
| 'maxUnhealthyUpgradedInstancePercent': max_unhealthy_upgraded_instance_percent, | ||
| 'pauseTimeBetweenBatches': pause_time_between_batches, | ||
| 'enableCrossZoneUpgrade': enable_cross_zone_upgrade, | ||
| 'prioritizeUnhealthyInstances': prioritize_unhealthy_instances | ||
| } | ||
| else: | ||
| vmss.upgrade_policy.rolling_upgrade_policy.max_batch_instance_percent = max_batch_instance_percent | ||
| vmss.upgrade_policy.rolling_upgrade_policy.max_unhealthy_instance_percent = max_unhealthy_instance_percent | ||
| vmss.upgrade_policy.rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = \ | ||
| max_unhealthy_upgraded_instance_percent | ||
| vmss.upgrade_policy.rolling_upgrade_policy.pause_time_between_batches = pause_time_between_batches | ||
| vmss.upgrade_policy.rolling_upgrade_policy.enable_cross_zone_upgrade = enable_cross_zone_upgrade | ||
| vmss.upgrade_policy.rolling_upgrade_policy.prioritize_unhealthy_instances = prioritize_unhealthy_instances | ||
|
|
||
| return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, | ||
| resource_group_name, name, **kwargs) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xfz11 Hi, I see that the
min_apiof these parameters is2020-12-01, but in fact, these parameters are already supported in version2020-06-01.Swagger link: code link
So I would like to confirm that those parameters are expected to be supported only after version
2020-12-01, right? (in this case, profile2020-09-01-hybriddoes not support those parameters)