Skip to content

Commit

Permalink
backport-3: ecs_service deployment_circuit_breaker (#1225)
Browse files Browse the repository at this point in the history
backport-3: ecs_service deployment_circuit_breaker

SUMMARY
manual backport of

#1215
#1217

there is no version_added, because the module already supports this feature. it was just undocumented.
ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request

COMPONENT NAME
ecs_service
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
markuman authored Jun 7, 2022
1 parent 7a5ece4 commit c630be0
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ecs_service - ``deployment_circuit_breaker`` has been added as a supported feature (https://github.com/ansible-collections/community.aws/pull/1215).
39 changes: 38 additions & 1 deletion plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
minimum_healthy_percent:
type: int
description: A lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment.
deployment_circuit_breaker:
type: dict
description: The deployment circuit breaker determines whether a service deployment will fail if the service can't reach a steady state.
suboptions:
enable:
type: bool
description: If enabled, a service deployment will transition to a failed state and stop launching new tasks.
rollback:
type: bool
description: If enabled, ECS will roll back your service to the last completed deployment after a failure.
placement_constraints:
description:
- The placement constraints for the tasks in the service.
Expand Down Expand Up @@ -328,6 +338,19 @@
description: minimumHealthyPercent param
returned: always
type: int
deploymentCircuitBreaker:
description: dictionary of deploymentCircuitBreaker
returned: always
type: complex
contains:
enable:
description: The state of the circuit breaker feature.
returned: always
type: bool
rollback:
description: The state of the rollback feature of the circuit breaker.
returned: always
type: bool
events:
description: list of service events
returned: always
Expand Down Expand Up @@ -444,6 +467,19 @@
description: minimumHealthyPercent param
returned: always
type: int
deploymentCircuitBreaker:
description: dictionary of deploymentCircuitBreaker
returned: always
type: complex
contains:
enable:
description: The state of the circuit breaker feature.
returned: always
type: bool
rollback:
description: The state of the rollback feature of the circuit breaker.
returned: always
type: bool
events:
description: list of service events
returned: always
Expand Down Expand Up @@ -485,7 +521,8 @@

DEPLOYMENT_CONFIGURATION_TYPE_MAP = {
'maximum_percent': 'int',
'minimum_healthy_percent': 'int'
'minimum_healthy_percent': 'int',
'deployment_circuit_breaker': 'dict',
}

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/targets/ecs_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ecs_task_containers:
ecs_service_deployment_configuration:
minimum_healthy_percent: 0
maximum_percent: 100
deployment_circuit_breaker:
enable: true
rollback: true
ecs_service_placement_strategy:
- type: binpack
field: memory
Expand Down
13 changes: 9 additions & 4 deletions tests/integration/targets/ecs_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,21 @@
role: "ecsServiceRole"
register: ecs_service

- name: check that placement constraint has been applied
- name: check that ECS service creation changed
assert:
that:
- ecs_service.changed
- "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"

- name: check that ECS service creation changed
- name: check that placement constraint has been applied
assert:
that:
- ecs_service.changed
- "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"

- name: check that ECS service was created with deployment_circuit_breaker
assert:
that:
- ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.enable
- ecs_service.service.deploymentConfiguration.deploymentCircuitBreaker.rollback

- name: create same ECS service definition (should not change)
ecs_service:
Expand Down

0 comments on commit c630be0

Please sign in to comment.