Skip to content

Commit 5bbdbab

Browse files
TratcherCopilotJuliehzl
authored
Depricate ingress scale settings (Azure#9026)
* Depricate ingress scale settings * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> Co-authored-by: Zunli Hu <[email protected]> * Revert test files * Fix params deprication version --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Zunli Hu <[email protected]>
1 parent d5b6a3d commit 5bbdbab

File tree

5 files changed

+9
-27
lines changed

5 files changed

+9
-27
lines changed

src/containerapp/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release History
55
upcoming
66
++++++
77
* 'az containerapp session code-interpreter': Fix `--path` in examples
8+
* 'az containerapp env premium-ingress': Deprecate `--min-replicas` and `--max-replicas` parameters, use workload profile scale instead.
89

910
1.2.0b3
1011
++++++

src/containerapp/azext_containerapp/_help.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@
23842384
examples:
23852385
- name: Enable premium ingress for the environment.
23862386
text: |
2387-
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName --min-replicas 2 --max-replicas 10
2387+
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName
23882388
"""
23892389

23902390
helps['containerapp env premium-ingress add'] = """
@@ -2395,7 +2395,7 @@
23952395
examples:
23962396
- name: Add the premium ingress settings for the environment.
23972397
text: |
2398-
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName --min-replicas 2 --max-replicas 10
2398+
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName
23992399
"""
24002400

24012401
helps['containerapp env premium-ingress update'] = """

src/containerapp/azext_containerapp/_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ def load_arguments(self, _):
515515
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)
516516
c.argument('name', options_list=['--name', '-n'], help="The name of the managed environment.")
517517
c.argument('workload_profile_name', options_list=['--workload-profile-name', '-w'], help="The workload profile to run ingress replicas on. This profile must not be shared with any container app or job.")
518-
c.argument('min_replicas', options_list=['--min-replicas'], type=int, help="Minimum number of replicas to run. Default 2, minimum 2.")
519-
c.argument('max_replicas', options_list=['--max-replicas'], type=int, help="Maximum number of replicas to run. Default 10. The upper limit is the maximum cores available in the workload profile.")
518+
c.argument('min_replicas', options_list=['--min-replicas'], type=int, deprecate_info=c.deprecate(hide=True, expiration='2.78.0'), help="The workload profile minimum instances is used instead.")
519+
c.argument('max_replicas', options_list=['--max-replicas'], type=int, deprecate_info=c.deprecate(hide=True, expiration='2.78.0'), help="The workload profile maximum instances is used instead.")
520520
c.argument('termination_grace_period', options_list=['--termination-grace-period', '-t'], type=int, help="Time in seconds to drain requests during ingress shutdown. Default 500, minimum 0, maximum 3600.")
521521
c.argument('request_idle_timeout', options_list=['--request-idle-timeout'], type=int, help="Timeout in minutes for idle requests. Default 4, minimum 1.")
522522
c.argument('header_count_limit', options_list=['--header-count-limit'], type=int, help="Limit of http headers per request. Default 100, minimum 1.")

src/containerapp/azext_containerapp/custom.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,21 +3844,17 @@ def show_environment_premium_ingress(cmd, name, resource_group_name):
38443844
handle_raw_exception(e)
38453845

38463846

3847-
def add_environment_premium_ingress(cmd, name, resource_group_name, workload_profile_name, min_replicas, max_replicas, termination_grace_period=None, request_idle_timeout=None, header_count_limit=None, no_wait=False):
3847+
def add_environment_premium_ingress(cmd, name, resource_group_name, workload_profile_name, min_replicas=None, max_replicas=None, termination_grace_period=None, request_idle_timeout=None, header_count_limit=None, no_wait=False):
38483848
_validate_subscription_registered(cmd, CONTAINER_APPS_RP)
38493849

38503850
try:
38513851
ManagedEnvironmentPreviewClient.show(cmd, resource_group_name, name)
38523852
env_patch = {}
38533853
ingress_config = {}
38543854
safe_set(env_patch, "properties", "ingressConfiguration", value=ingress_config)
3855-
scale = {}
3856-
ingress_config["scale"] = scale
38573855

38583856
# Required
38593857
ingress_config["workloadProfileName"] = workload_profile_name
3860-
scale["minReplicas"] = min_replicas
3861-
scale["maxReplicas"] = max_replicas
38623858
# Optional, remove if None
38633859
ingress_config["terminationGracePeriodSeconds"] = termination_grace_period
38643860
ingress_config["requestIdleTimeout"] = request_idle_timeout
@@ -3885,16 +3881,9 @@ def update_environment_premium_ingress(cmd, name, resource_group_name, workload_
38853881
ManagedEnvironmentPreviewClient.show(cmd, resource_group_name, name)
38863882
env_patch = {}
38873883
ingress_config = {}
3888-
scale = {}
38893884

38903885
if workload_profile_name is not None:
38913886
ingress_config["workloadProfileName"] = workload_profile_name
3892-
if min_replicas is not None:
3893-
ingress_config["scale"] = scale
3894-
scale["minReplicas"] = min_replicas
3895-
if max_replicas is not None:
3896-
ingress_config["scale"] = scale
3897-
scale["maxReplicas"] = max_replicas
38983887
if termination_grace_period is not None:
38993888
ingress_config["terminationGracePeriodSeconds"] = termination_grace_period
39003889
if request_idle_timeout is not None:

src/containerapp/azext_containerapp/tests/latest/test_containerapp_commands.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -673,38 +673,30 @@ def test_containerapp_env_premium_ingress_commands(self, resource_group):
673673
JMESPathCheck('message', 'No premium ingress configuration found for this environment, using default values.'),
674674
])
675675

676-
self.cmd(f'containerapp env premium-ingress add -g {resource_group} -n {env_name} -w wp-ingress --min-replicas 3 --max-replicas 5', checks=[
676+
self.cmd(f'containerapp env premium-ingress add -g {resource_group} -n {env_name} -w wp-ingress', checks=[
677677
JMESPathCheck('workloadProfileName', 'wp-ingress'),
678-
JMESPathCheck('scale.minReplicas', 3),
679-
JMESPathCheck('scale.maxReplicas', 5),
680678
JMESPathCheck('terminationGracePeriodSeconds', None),
681679
JMESPathCheck('requestIdleTimeout', None),
682680
JMESPathCheck('headerCountLimit', None),
683681
])
684682

685683
self.cmd(f'containerapp env premium-ingress show -g {resource_group} -n {env_name}', checks=[
686684
JMESPathCheck('workloadProfileName', 'wp-ingress'),
687-
JMESPathCheck('scale.minReplicas', 3),
688-
JMESPathCheck('scale.maxReplicas', 5),
689685
JMESPathCheck('terminationGracePeriodSeconds', None),
690686
JMESPathCheck('requestIdleTimeout', None),
691687
JMESPathCheck('headerCountLimit', None),
692688
])
693689

694-
self.cmd(f'containerapp env premium-ingress update -g {resource_group} -n {env_name} --min-replicas 4 --max-replicas 20 --termination-grace-period 45 --request-idle-timeout 180 --header-count-limit 40', checks=[
690+
self.cmd(f'containerapp env premium-ingress update -g {resource_group} -n {env_name} --termination-grace-period 45 --request-idle-timeout 180 --header-count-limit 40', checks=[
695691
JMESPathCheck('workloadProfileName', 'wp-ingress'),
696-
JMESPathCheck('scale.minReplicas', 4),
697-
JMESPathCheck('scale.maxReplicas', 20),
698692
JMESPathCheck('terminationGracePeriodSeconds', 45),
699693
JMESPathCheck('requestIdleTimeout', 180),
700694
JMESPathCheck('headerCountLimit', 40),
701695
])
702696

703697
# set removes unspecified optional parameters
704-
self.cmd(f'containerapp env premium-ingress add -g {resource_group} -n {env_name} -w wp-ingress --min-replicas 2 --max-replicas 3 --request-idle-timeout 90', checks=[
698+
self.cmd(f'containerapp env premium-ingress add -g {resource_group} -n {env_name} -w wp-ingress --request-idle-timeout 90', checks=[
705699
JMESPathCheck('workloadProfileName', 'wp-ingress'),
706-
JMESPathCheck('scale.minReplicas', 2),
707-
JMESPathCheck('scale.maxReplicas', 3),
708700
JMESPathCheck('requestIdleTimeout', 90),
709701
JMESPathCheck('terminationGracePeriodSeconds', None),
710702
JMESPathCheck('headerCountLimit', None),

0 commit comments

Comments
 (0)