Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release History
upcoming
++++++
* 'az containerapp session code-interpreter': Fix `--path` in examples
* 'az containerapp env premium-ingress': Deprecate `--min-replicas` and `--max-replicas` parameters, use workload profile scale instead.

1.2.0b3
++++++
Expand Down
4 changes: 2 additions & 2 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@
examples:
- name: Enable premium ingress for the environment.
text: |
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName --min-replicas 2 --max-replicas 10
az containerapp env premium-ingress add -g MyResourceGroup -n MyEnvironment -w WorkloadProfileName
"""

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

helps['containerapp env premium-ingress update'] = """
Expand Down
4 changes: 2 additions & 2 deletions src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ def load_arguments(self, _):
c.argument('resource_group_name', arg_type=resource_group_name_type, id_part=None)
c.argument('name', options_list=['--name', '-n'], help="The name of the managed environment.")
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.")
c.argument('min_replicas', options_list=['--min-replicas'], type=int, help="Minimum number of replicas to run. Default 2, minimum 2.")
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.")
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.")
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.")
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.")
c.argument('request_idle_timeout', options_list=['--request-idle-timeout'], type=int, help="Timeout in minutes for idle requests. Default 4, minimum 1.")
c.argument('header_count_limit', options_list=['--header-count-limit'], type=int, help="Limit of http headers per request. Default 100, minimum 1.")
13 changes: 1 addition & 12 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3844,21 +3844,17 @@ def show_environment_premium_ingress(cmd, name, resource_group_name):
handle_raw_exception(e)


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):
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):
_validate_subscription_registered(cmd, CONTAINER_APPS_RP)

try:
ManagedEnvironmentPreviewClient.show(cmd, resource_group_name, name)
env_patch = {}
ingress_config = {}
safe_set(env_patch, "properties", "ingressConfiguration", value=ingress_config)
scale = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls keep the code until parameter is removed. Currently they are in deprecated mode and hidden to customers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The control plane change has already fully deployed, the properties are ignored and there's no reason to send them.

ingress_config["scale"] = scale

# Required
ingress_config["workloadProfileName"] = workload_profile_name
scale["minReplicas"] = min_replicas
scale["maxReplicas"] = max_replicas
# Optional, remove if None
ingress_config["terminationGracePeriodSeconds"] = termination_grace_period
ingress_config["requestIdleTimeout"] = request_idle_timeout
Expand All @@ -3885,16 +3881,9 @@ def update_environment_premium_ingress(cmd, name, resource_group_name, workload_
ManagedEnvironmentPreviewClient.show(cmd, resource_group_name, name)
env_patch = {}
ingress_config = {}
scale = {}

if workload_profile_name is not None:
ingress_config["workloadProfileName"] = workload_profile_name
if min_replicas is not None:
ingress_config["scale"] = scale
scale["minReplicas"] = min_replicas
if max_replicas is not None:
ingress_config["scale"] = scale
scale["maxReplicas"] = max_replicas
if termination_grace_period is not None:
ingress_config["terminationGracePeriodSeconds"] = termination_grace_period
if request_idle_timeout is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,38 +673,30 @@ def test_containerapp_env_premium_ingress_commands(self, resource_group):
JMESPathCheck('message', 'No premium ingress configuration found for this environment, using default values.'),
])

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

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

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=[
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=[
JMESPathCheck('workloadProfileName', 'wp-ingress'),
JMESPathCheck('scale.minReplicas', 4),
JMESPathCheck('scale.maxReplicas', 20),
JMESPathCheck('terminationGracePeriodSeconds', 45),
JMESPathCheck('requestIdleTimeout', 180),
JMESPathCheck('headerCountLimit', 40),
])

# set removes unspecified optional parameters
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=[
self.cmd(f'containerapp env premium-ingress add -g {resource_group} -n {env_name} -w wp-ingress --request-idle-timeout 90', checks=[
JMESPathCheck('workloadProfileName', 'wp-ingress'),
JMESPathCheck('scale.minReplicas', 2),
JMESPathCheck('scale.maxReplicas', 3),
JMESPathCheck('requestIdleTimeout', 90),
JMESPathCheck('terminationGracePeriodSeconds', None),
JMESPathCheck('headerCountLimit', None),
Expand Down
Loading