Skip to content

Commit 24e8846

Browse files
{AKS} Rename to addon-autoscaling preview CLI to optimized-addon-scaling (Azure#8617)
* rename to optimized addon scaling * address comment * fix style error --------- Co-authored-by: chihshenghuang <[email protected]>
1 parent e369d00 commit 24e8846

File tree

11 files changed

+78
-71
lines changed

11 files changed

+78
-71
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Pending
1313
+++++++
1414
* Vendor new SDK and bump API version to 2025-01-02-preview.
1515

16+
14.0.0b1
17+
+++++++
18+
* [BREAKING CHANGE] Rename `--enable-addon-autoscaling` to `--enable-optimized-addon-scaling` to `az aks create` commands.
19+
* [BREAKING CHANGE] Rename `--enable-addon-autoscaling` to `--enable-optimized-addon-scaling` and `--disable-addon-autoscaling` to `--disable-optimized-addon-scaling` to `az aks update` commands.
20+
1621
13.0.0b9
1722
+++++++
1823
* Vendor new SDK and bump API version to 2024-10-02-preview.

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@
528528
- name: --enable-vpa
529529
type: bool
530530
short-summary: Enable vertical pod autoscaler for cluster.
531-
- name: --enable-addon-autoscaling
531+
- name: --enable-optimized-addon-scaling
532532
type: bool
533-
short-summary: Enable addon autoscaling for cluster.
533+
short-summary: Enable optimized addon scaling feature for cluster.
534534
- name: --nodepool-allowed-host-ports
535535
type: string
536536
short-summary: Expose host ports on the node pool. When specified, format should be a comma-separated list of ranges with protocol, eg. 80/TCP,443/TCP,4000-5000/TCP.
@@ -1170,12 +1170,12 @@
11701170
- name: --disable-vpa
11711171
type: bool
11721172
short-summary: Disable vertical pod autoscaler for cluster.
1173-
- name: --enable-addon-autoscaling
1173+
- name: --enable-optimized-addon-scaling
11741174
type: bool
1175-
short-summary: Enable addon autoscaling for cluster.
1176-
- name: --disable-addon-autoscaling
1175+
short-summary: Enable optimized addon scaling feature for cluster.
1176+
- name: --disable-optimized-addon-scaling
11771177
type: bool
1178-
short-summary: Disable addon autoscaling for cluster.
1178+
short-summary: Disable optimized addon scaling feature for cluster.
11791179
- name: --cluster-snapshot-id
11801180
type: string
11811181
short-summary: The source cluster snapshot id is used to update existing cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,10 @@ def load_arguments(self, _):
798798
help="enable vertical pod autoscaler for cluster",
799799
)
800800
c.argument(
801-
"enable_addon_autoscaling",
801+
"enable_optimized_addon_scaling",
802802
action="store_true",
803803
is_preview=True,
804-
help="enable addon autoscaling for cluster",
804+
help="enable optimized addon scaling for cluster",
805805
)
806806
c.argument(
807807
"enable_cilium_dataplane",
@@ -1257,16 +1257,16 @@ def load_arguments(self, _):
12571257
help="disable vertical pod autoscaler for cluster",
12581258
)
12591259
c.argument(
1260-
"enable_addon_autoscaling",
1260+
"enable_optimized_addon_scaling",
12611261
action="store_true",
12621262
is_preview=True,
1263-
help="enable addon autoscaling for cluster",
1263+
help="enable optimized addon scaling for cluster",
12641264
)
12651265
c.argument(
1266-
"disable_addon_autoscaling",
1266+
"disable_optimized_addon_scaling",
12671267
action="store_true",
12681268
is_preview=True,
1269-
help="disable addon autoscaling for cluster",
1269+
help="disable optimized addon scaling for cluster",
12701270
)
12711271
c.argument(
12721272
"cluster_snapshot_id",

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def aks_create(
486486
dns_zone_resource_ids=None,
487487
enable_keda=False,
488488
enable_vpa=False,
489-
enable_addon_autoscaling=False,
489+
enable_optimized_addon_scaling=False,
490490
enable_cilium_dataplane=False,
491491
custom_ca_trust_certificates=None,
492492
# advanced networking
@@ -711,8 +711,8 @@ def aks_update(
711711
disable_azure_monitor_app_monitoring=False,
712712
enable_vpa=False,
713713
disable_vpa=False,
714-
enable_addon_autoscaling=False,
715-
disable_addon_autoscaling=False,
714+
enable_optimized_addon_scaling=False,
715+
disable_optimized_addon_scaling=False,
716716
cluster_snapshot_id=None,
717717
custom_ca_trust_certificates=None,
718718
# safeguards parameters

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,62 +2130,64 @@ def get_disable_vpa(self) -> bool:
21302130
"""
21312131
return self._get_disable_vpa(enable_validation=True)
21322132

2133-
def _get_enable_addon_autoscaling(self, enable_validation: bool = False) -> bool:
2134-
"""Internal function to obtain the value of enable_addon_autoscaling.
2135-
This function supports the option of enable_addon_autoscaling.
2136-
When enabled, if both enable_addon_autoscaling and disable_addon_autoscaling are
2133+
def _get_enable_optimized_addon_scaling(self, enable_validation: bool = False) -> bool:
2134+
"""Internal function to obtain the value of enable_optimized_addon_scaling.
2135+
This function supports the option of enable_optimized_addon_scaling.
2136+
When enabled, if both enable_optimized_addon_scaling and disable_optimized_addon_scaling are
21372137
specified, raise a MutuallyExclusiveArgumentError.
21382138
:return: bool
21392139
"""
21402140
# Read the original value passed by the command.
2141-
enable_addon_autoscaling = self.raw_param.get("enable_addon_autoscaling")
2141+
enable_optimized_addon_scaling = self.raw_param.get("enable_optimized_addon_scaling")
21422142

21432143
# This parameter does not need dynamic completion.
21442144
if enable_validation:
2145-
if enable_addon_autoscaling and self._get_disable_addon_autoscaling(enable_validation=False):
2145+
if enable_optimized_addon_scaling and self._get_disable_optimized_addon_scaling(enable_validation=False):
21462146
raise MutuallyExclusiveArgumentError(
2147-
"Cannot specify --enable-addon-autoscaling and --disable-addon-autoscaling at the same time."
2147+
"Cannot specify --enable-optimized-addon-scaling and \
2148+
--disable-optimized-addon-scaling at the same time."
21482149
)
21492150

2150-
return enable_addon_autoscaling
2151+
return enable_optimized_addon_scaling
21512152

2152-
def get_enable_addon_autoscaling(self) -> bool:
2153-
"""Obtain the value of enable_addon_autoscaling.
2153+
def get_enable_optimized_addon_scaling(self) -> bool:
2154+
"""Obtain the value of enable_optimized_addon_scaling.
21542155
This function will verify the parameter by default.
2155-
If both enable_addon_autoscaling and disable_addon_autoscaling are specified,
2156+
If both enable_optimized_addon_scaling and disable_optimized_addon_scaling are specified,
21562157
raise a MutuallyExclusiveArgumentError.
21572158
:return: bool
21582159
"""
2159-
return self._get_enable_addon_autoscaling(enable_validation=True)
2160+
return self._get_enable_optimized_addon_scaling(enable_validation=True)
21602161

2161-
def _get_disable_addon_autoscaling(self, enable_validation: bool = False) -> bool:
2162-
"""Internal function to obtain the value of disable_addon_autoscaling.
2163-
This function supports the option of enable_addon_autoscaling.
2164-
When enabled, if both enable_addon_autoscaling and disable_addon_autoscaling are specified,
2162+
def _get_disable_optimized_addon_scaling(self, enable_validation: bool = False) -> bool:
2163+
"""Internal function to obtain the value of disable_optimized_addon_scaling.
2164+
This function supports the option of enable_optimized_addon_scaling.
2165+
When enabled, if both enable_optimized_addon_scaling and disable_optimized_addon_scaling are specified,
21652166
raise a MutuallyExclusiveArgumentError.
21662167
:return: bool
21672168
"""
21682169
# Read the original value passed by the command.
2169-
disable_addon_autoscaling = self.raw_param.get("disable_addon_autoscaling")
2170+
disable_optimized_addon_scaling = self.raw_param.get("disable_optimized_addon_scaling")
21702171

21712172
# This option is not supported in create mode, hence we do not read the property value from the `mc` object.
21722173
# This parameter does not need dynamic completion.
21732174
if enable_validation:
2174-
if disable_addon_autoscaling and self._get_enable_addon_autoscaling(enable_validation=False):
2175+
if disable_optimized_addon_scaling and self._get_enable_optimized_addon_scaling(enable_validation=False):
21752176
raise MutuallyExclusiveArgumentError(
2176-
"Cannot specify --enable-addon-autoscaling and --disable-addon-autoscaling at the same time."
2177+
"Cannot specify --enable-optimized-addon-scaling and \
2178+
--disable-optimized-addon-scaling at the same time."
21772179
)
21782180

2179-
return disable_addon_autoscaling
2181+
return disable_optimized_addon_scaling
21802182

2181-
def get_disable_addon_autoscaling(self) -> bool:
2182-
"""Obtain the value of disable_addon_autoscaling.
2183+
def get_disable_optimized_addon_scaling(self) -> bool:
2184+
"""Obtain the value of disable_optimized_addon_scaling.
21832185
This function will verify the parameter by default.
2184-
If both enable_addon_autoscaling and disable_addon_autoscaling are specified,
2186+
If both enable_optimized_addon_scaling and disable_optimized_addon_scaling are specified,
21852187
raise a MutuallyExclusiveArgumentError.
21862188
:return: bool
21872189
"""
2188-
return self._get_disable_addon_autoscaling(enable_validation=True)
2190+
return self._get_disable_optimized_addon_scaling(enable_validation=True)
21892191

21902192
def get_ssh_key_value_for_update(self) -> Tuple[str, bool]:
21912193
"""Obtain the value of ssh_key_value for "az aks update".
@@ -3161,14 +3163,14 @@ def set_up_vpa(self, mc: ManagedCluster) -> ManagedCluster:
31613163
mc.workload_auto_scaler_profile.vertical_pod_autoscaler.enabled = True
31623164
return mc
31633165

3164-
def set_up_addon_autoscaling(self, mc: ManagedCluster) -> ManagedCluster:
3166+
def set_up_optimized_addon_scaling(self, mc: ManagedCluster) -> ManagedCluster:
31653167
"""Set up workload auto-scaler vertical pod autsocaler profile
31663168
for the ManagedCluster object.
31673169
:return: the ManagedCluster object
31683170
"""
31693171
self._ensure_mc(mc)
31703172

3171-
if self.context.get_enable_addon_autoscaling():
3173+
if self.context.get_enable_optimized_addon_scaling():
31723174
if mc.workload_auto_scaler_profile is None:
31733175
mc.workload_auto_scaler_profile = self.models.ManagedClusterWorkloadAutoScalerProfile() # pylint: disable=no-member
31743176
if mc.workload_auto_scaler_profile.vertical_pod_autoscaler is None:
@@ -3563,8 +3565,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
35633565
mc = self.set_up_workload_auto_scaler_profile(mc)
35643566
# set up vpa
35653567
mc = self.set_up_vpa(mc)
3566-
# set up addon autoscaling
3567-
mc = self.set_up_addon_autoscaling(mc)
3568+
# set up optimized addon scaling
3569+
mc = self.set_up_optimized_addon_scaling(mc)
35683570
# set up kube-proxy config
35693571
mc = self.set_up_kube_proxy_config(mc)
35703572
# set up custom ca trust certificates
@@ -4710,14 +4712,14 @@ def update_vpa(self, mc: ManagedCluster) -> ManagedCluster:
47104712

47114713
return mc
47124714

4713-
def update_addon_autoscaling(self, mc: ManagedCluster) -> ManagedCluster:
4715+
def update_optimized_addon_scaling(self, mc: ManagedCluster) -> ManagedCluster:
47144716
"""Update workload auto-scaler vertical pod auto-scaler profile
47154717
for the ManagedCluster object.
47164718
:return: the ManagedCluster object
47174719
"""
47184720
self._ensure_mc(mc)
47194721

4720-
if self.context.get_enable_addon_autoscaling():
4722+
if self.context.get_enable_optimized_addon_scaling():
47214723
if mc.workload_auto_scaler_profile is None:
47224724
mc.workload_auto_scaler_profile = self.models.ManagedClusterWorkloadAutoScalerProfile() # pylint: disable=no-member
47234725
if mc.workload_auto_scaler_profile.vertical_pod_autoscaler is None:
@@ -4728,7 +4730,7 @@ def update_addon_autoscaling(self, mc: ManagedCluster) -> ManagedCluster:
47284730
mc.workload_auto_scaler_profile.vertical_pod_autoscaler.enabled = True
47294731
mc.workload_auto_scaler_profile.vertical_pod_autoscaler.addon_autoscaling = "Enabled"
47304732

4731-
if self.context.get_disable_addon_autoscaling():
4733+
if self.context.get_disable_optimized_addon_scaling():
47324734
if mc.workload_auto_scaler_profile is None:
47334735
mc.workload_auto_scaler_profile = self.models.ManagedClusterWorkloadAutoScalerProfile() # pylint: disable=no-member
47344736
if mc.workload_auto_scaler_profile.vertical_pod_autoscaler is None:
@@ -5255,8 +5257,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
52555257
mc = self.update_azure_monitor_profile(mc)
52565258
# update vpa
52575259
mc = self.update_vpa(mc)
5258-
# update addon autoscaling
5259-
mc = self.update_addon_autoscaling(mc)
5260+
# update optimized addon scaling
5261+
mc = self.update_optimized_addon_scaling(mc)
52605262
# update creation data
52615263
mc = self.update_creation_data(mc)
52625264
# update linux profile

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_create_with_addon_autoscaling.yaml renamed to src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_create_with_optimized_addon_scaling.yaml

File renamed without changes.

src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_update_with_addon_autoscaling.yaml renamed to src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_update_with_optimized_addon_scaling.yaml

File renamed without changes.

src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def test_aks_create_and_update_with_vpa(
587587
@AKSCustomResourceGroupPreparer(
588588
random_name_length=17, name_prefix="clitest", location="westus2"
589589
)
590-
def test_aks_create_with_addon_autoscaling(
590+
def test_aks_create_with_optimized_addon_scaling(
591591
self, resource_group, resource_group_location
592592
):
593593
# reset the count so in replay mode the random names will start with 0
@@ -609,7 +609,7 @@ def test_aks_create_with_addon_autoscaling(
609609
create_cmd = (
610610
"aks create --resource-group={resource_group} --name={name} "
611611
"--vm-set-type VirtualMachineScaleSets -c 1 "
612-
"--enable-addon-autoscaling "
612+
"--enable-optimized-addon-scaling "
613613
"--kubernetes-version={k8s_version} "
614614
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AKS-AddonAutoscalingPreview "
615615
"--ssh-key-value={ssh_key_value} -o json"
@@ -642,7 +642,7 @@ def test_aks_create_with_addon_autoscaling(
642642
@AKSCustomResourceGroupPreparer(
643643
random_name_length=17, name_prefix="clitest", location="westus2"
644644
)
645-
def test_aks_update_with_addon_autoscaling(
645+
def test_aks_update_with_optimized_addon_scaling(
646646
self, resource_group, resource_group_location
647647
):
648648
# reset the count so in replay mode the random names will start with 0
@@ -678,7 +678,7 @@ def test_aks_update_with_addon_autoscaling(
678678
update_cmd = (
679679
"aks update --resource-group={resource_group} --name={name} "
680680
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AKS-AddonAutoscalingPreview "
681-
"--enable-addon-autoscaling -o json"
681+
"--enable-optimized-addon-scaling -o json"
682682
)
683683
self.cmd(
684684
update_cmd,
@@ -697,7 +697,7 @@ def test_aks_update_with_addon_autoscaling(
697697
update_cmd = (
698698
"aks update --resource-group={resource_group} --name={name} "
699699
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AKS-AddonAutoscalingPreview "
700-
"--disable-addon-autoscaling -o json"
700+
"--disable-optimized-addon-scaling -o json"
701701
)
702702
self.cmd(
703703
update_cmd,

src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5084,7 +5084,7 @@ def test_set_up_vpa(self):
50845084

50855085
self.assertEqual(dec_mc_2, ground_truth_mc_2)
50865086

5087-
def test_set_up_addon_autoscaling(self):
5087+
def test_set_up_optimized_addon_scaling(self):
50885088
dec_1 = AKSPreviewManagedClusterCreateDecorator(
50895089
self.cmd,
50905090
self.client,
@@ -5093,19 +5093,19 @@ def test_set_up_addon_autoscaling(self):
50935093
)
50945094
mc_1 = self.models.ManagedCluster(location="test_location")
50955095
dec_1.context.attach_mc(mc_1)
5096-
dec_mc_1 = dec_1.set_up_addon_autoscaling(mc_1)
5096+
dec_mc_1 = dec_1.set_up_optimized_addon_scaling(mc_1)
50975097
ground_truth_mc_1 = self.models.ManagedCluster(location="test_location")
50985098
self.assertEqual(dec_mc_1, ground_truth_mc_1)
50995099

51005100
dec_2 = AKSPreviewManagedClusterCreateDecorator(
51015101
self.cmd,
51025102
self.client,
5103-
{"enable_addon_autoscaling": True},
5103+
{"enable_optimized_addon_scaling": True},
51045104
CUSTOM_MGMT_AKS_PREVIEW,
51055105
)
51065106
mc_2 = self.models.ManagedCluster(location="test_location")
51075107
dec_2.context.attach_mc(mc_2)
5108-
dec_mc_2 = dec_2.set_up_addon_autoscaling(mc_2)
5108+
dec_mc_2 = dec_2.set_up_optimized_addon_scaling(mc_2)
51095109
workload_auto_scaler_profile = (
51105110
self.models.ManagedClusterWorkloadAutoScalerProfile()
51115111
)
@@ -8017,7 +8017,7 @@ def test_update_upgrade_settings(self):
80178017
with self.assertRaises(InvalidArgumentValueError):
80188018
dec_6.update_upgrade_settings(mc_6)
80198019

8020-
def test_update_addon_autoscaling(self):
8020+
def test_update_optimized_addon_scaling(self):
80218021
# Should not update mc if unset
80228022
dec_0 = AKSPreviewManagedClusterUpdateDecorator(
80238023
self.cmd,
@@ -8029,7 +8029,7 @@ def test_update_addon_autoscaling(self):
80298029
location="test_location",
80308030
)
80318031
dec_0.context.attach_mc(mc_0)
8032-
dec_mc_0 = dec_0.update_addon_autoscaling(mc_0)
8032+
dec_mc_0 = dec_0.update_optimized_addon_scaling(mc_0)
80338033
ground_truth_mc_0 = self.models.ManagedCluster(
80348034
location="test_location",
80358035
)
@@ -8039,28 +8039,28 @@ def test_update_addon_autoscaling(self):
80398039
dec_1 = AKSPreviewManagedClusterUpdateDecorator(
80408040
self.cmd,
80418041
self.client,
8042-
{"enable_addon_autoscaling": True, "disable_addon_autoscaling": True},
8042+
{"enable_optimized_addon_scaling": True, "disable_optimized_addon_scaling": True},
80438043
CUSTOM_MGMT_AKS_PREVIEW,
80448044
)
80458045
mc_1 = self.models.ManagedCluster(
80468046
location="test_location",
80478047
)
80488048
dec_1.context.attach_mc(mc_1)
80498049
with self.assertRaises(MutuallyExclusiveArgumentError):
8050-
dec_1.update_addon_autoscaling(mc_1)
8050+
dec_1.update_optimized_addon_scaling(mc_1)
80518051

8052-
# enable addon autoscaling should set addon_autoscaling to Enabled
8052+
# enable optimized addon scaling should set optimized_addon_scaling to Enabled
80538053
dec_2 = AKSPreviewManagedClusterUpdateDecorator(
80548054
self.cmd,
80558055
self.client,
8056-
{"enable_addon_autoscaling": True},
8056+
{"enable_optimized_addon_scaling": True},
80578057
CUSTOM_MGMT_AKS_PREVIEW,
80588058
)
80598059
mc_2 = self.models.ManagedCluster(
80608060
location="test_location",
80618061
)
80628062
dec_2.context.attach_mc(mc_2)
8063-
dec_mc_2 = dec_2.update_addon_autoscaling(mc_2)
8063+
dec_mc_2 = dec_2.update_optimized_addon_scaling(mc_2)
80648064
workload_auto_scaler_profile = (
80658065
self.models.ManagedClusterWorkloadAutoScalerProfile()
80668066
)
@@ -8076,18 +8076,18 @@ def test_update_addon_autoscaling(self):
80768076
)
80778077
self.assertEqual(dec_mc_2, ground_truth_mc_2)
80788078

8079-
# disable addon autoscaling should set addon_autoscaling to Disabled
8079+
# disable optimized addon scaling should set optimized_addon_scaling to Disabled
80808080
dec_3 = AKSPreviewManagedClusterUpdateDecorator(
80818081
self.cmd,
80828082
self.client,
8083-
{"disable_addon_autoscaling": True},
8083+
{"disable_optimized_addon_scaling": True},
80848084
CUSTOM_MGMT_AKS_PREVIEW,
80858085
)
80868086
mc_3 = self.models.ManagedCluster(
80878087
location="test_location",
80888088
)
80898089
dec_3.context.attach_mc(mc_3)
8090-
dec_mc_3 = dec_3.update_addon_autoscaling(mc_3)
8090+
dec_mc_3 = dec_3.update_optimized_addon_scaling(mc_3)
80918091
workload_auto_scaler_profile = (
80928092
self.models.ManagedClusterWorkloadAutoScalerProfile()
80938093
)

0 commit comments

Comments
 (0)