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 create/update': --termination-grace-period support custom termination grace period

0.3.34
++++++
Expand Down
2 changes: 2 additions & 0 deletions src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def load_arguments(self, _):
c.argument('traffic_weights', nargs='*', options_list=['--traffic-weight'], help="A list of revision weight(s) for the container app. Space-separated values in 'revision_name=weight' format. For latest revision, use 'latest=weight'")
c.argument('workload_profile_name', options_list=['--workload-profile-name', '-w'], help="Name of the workload profile to run the app on.", is_preview=True)
c.argument('secret_volume_mount', help="Path to mount all secrets e.g. mnt/secrets", is_preview=True)
c.argument('termination_grace_period', type=int, options_list=['--termination-grace-period', '--tgp'], help="Duration in seconds a replica is given to gracefully shut down before it is forcefully terminated. (Default: 30)", is_preview=True)

with self.argument_context('containerapp create', arg_group='Identity') as c:
c.argument('user_assigned', nargs='+', help="Space-separated user identities to be assigned.")
Expand All @@ -141,6 +142,7 @@ def load_arguments(self, _):
c.argument('image', options_list=['--image', '-i'], help="Container image, e.g. publisher/image-name:tag.")
c.argument('workload_profile_name', options_list=['--workload-profile-name', '-w'], help='The friendly name for the workload profile', is_preview=True)
c.argument('secret_volume_mount', help="Path to mount all secrets e.g. mnt/secrets", is_preview=True)
c.argument('termination_grace_period', type=int, options_list=['--termination-grace-period', '--tgp'], help="Duration in seconds a replica is given to gracefully shut down before it is forcefully terminated. (Default: 30)", is_preview=True)

# Springboard
with self.argument_context('containerapp update', arg_group='Service Binding') as c:
Expand Down
7 changes: 7 additions & 0 deletions src/containerapp/azext_containerapp/_sdk_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7808,6 +7808,8 @@ class Template(_serialization.Model):

:ivar revision_suffix: User friendly suffix that is appended to the revision name.
:vartype revision_suffix: str
:ivar termination_grace_period_seconds: Gracefully shut down periods in seconds for the revision
:vartype termination_grace_period_seconds: int
:ivar init_containers: List of specialized containers that run before app containers.
:vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer]
:ivar containers: List of container definitions for the Container App.
Expand All @@ -7822,6 +7824,7 @@ class Template(_serialization.Model):

_attribute_map = {
"revision_suffix": {"key": "revisionSuffix", "type": "str"},
"termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"},
"init_containers": {"key": "initContainers", "type": "[InitContainer]"},
"containers": {"key": "containers", "type": "[Container]"},
"scale": {"key": "scale", "type": "Scale"},
Expand All @@ -7833,6 +7836,7 @@ def __init__(
self,
*,
revision_suffix: Optional[str] = None,
termination_grace_period_seconds: Optional[int] = None,
init_containers: Optional[List["_models.InitContainer"]] = None,
containers: Optional[List["_models.Container"]] = None,
scale: Optional["_models.Scale"] = None,
Expand All @@ -7843,6 +7847,8 @@ def __init__(
"""
:keyword revision_suffix: User friendly suffix that is appended to the revision name.
:paramtype revision_suffix: str
:keyword termination_grace_period_seconds: Gracefully shut down periods in seconds for the revision
:paramtype termination_grace_period_seconds: int
:keyword init_containers: List of specialized containers that run before app containers.
:paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer]
:keyword containers: List of container definitions for the Container App.
Expand All @@ -7856,6 +7862,7 @@ def __init__(
"""
super().__init__(**kwargs)
self.revision_suffix = revision_suffix
self.termination_grace_period_seconds = termination_grace_period_seconds
self.init_containers = init_containers
self.containers = containers
self.scale = scale
Expand Down
10 changes: 10 additions & 0 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ def create_containerapp(cmd,
user_assigned=None,
registry_identity=None,
workload_profile_name=None,
termination_grace_period=None,
secret_volume_mount=None):
register_provider_if_needed(cmd, CONTAINER_APPS_RP)
validate_container_app_name(name, AppType.ContainerApp.name)
Expand Down Expand Up @@ -668,6 +669,9 @@ def create_containerapp(cmd,
if revision_suffix is not None and not is_registry_msi_system(registry_identity):
template_def["revisionSuffix"] = revision_suffix

if termination_grace_period is not None:
template_def["terminationGracePeriodSeconds"] = termination_grace_period

containerapp_def = ContainerAppModel
containerapp_def["location"] = location
containerapp_def["identity"] = identity_def
Expand Down Expand Up @@ -763,6 +767,7 @@ def update_containerapp_logic(cmd,
ingress=None,
target_port=None,
workload_profile_name=None,
termination_grace_period=None,
registry_server=None,
registry_user=None,
registry_pass=None,
Expand Down Expand Up @@ -881,6 +886,9 @@ def update_containerapp_logic(cmd,
new_containerapp["properties"]["template"] = {} if "template" not in new_containerapp["properties"] else new_containerapp["properties"]["template"]
new_containerapp["properties"]["template"]["revisionSuffix"] = revision_suffix

if termination_grace_period is not None:
safe_set(new_containerapp, "properties", "template", "terminationGracePeriodSeconds", value=termination_grace_period)

if workload_profile_name:
new_containerapp["properties"]["workloadProfileName"] = workload_profile_name

Expand Down Expand Up @@ -1220,6 +1228,7 @@ def update_containerapp(cmd,
args=None,
tags=None,
workload_profile_name=None,
termination_grace_period=None,
no_wait=False,
secret_volume_mount=None):
_validate_subscription_registered(cmd, CONTAINER_APPS_RP)
Expand Down Expand Up @@ -1250,6 +1259,7 @@ def update_containerapp(cmd,
args=args,
tags=tags,
workload_profile_name=workload_profile_name,
termination_grace_period=termination_grace_period,
no_wait=no_wait,
secret_volume_mount=secret_volume_mount)

Expand Down
Loading