-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ecs_service supports constraints and strategy update #1601
ecs_service supports constraints and strategy update #1601
Conversation
@zhoufeng1989 looks basically good to me. |
Sure, will do it |
hi, @markuman , integration test cases are added, would you please have a look? thanks~ |
@zhoufeng1989 can you apply those changes? diff --git a/tests/integration/targets/ecs_cluster/tasks/main.yml b/tests/integration/targets/ecs_cluster/tasks/main.yml
index d105d087..7c81a346 100644
--- a/tests/integration/targets/ecs_cluster/tasks/main.yml
+++ b/tests/integration/targets/ecs_cluster/tasks/main.yml
@@ -108,19 +108,21 @@
vpc_id: '{{ setup_vpc.vpc.id }}'
rules: # allow all ssh traffic but nothing else
- ports: 22
- cidr: 0.0.0.0/0
+ cidr_ip: 0.0.0.0/0
register: setup_sg
- - name: find a suitable AMI
- ec2_ami_info:
- owner: amazon
- filters:
- description: "Amazon Linux AMI* ECS *"
- register: ec2_ami_info
+ - set_fact:
+ # As a lookup plugin we don't have access to module_defaults
+ connection_args:
+ region: "{{ aws_region }}"
+ aws_access_key: "{{ aws_access_key }}"
+ aws_secret_key: "{{ aws_secret_key }}"
+ aws_security_token: "{{ security_token | default(omit) }}"
+ no_log: True
- name: set image id fact
set_fact:
- ecs_image_id: "{{ (ec2_ami_info.images|last).image_id }}"
+ ecs_image_id: "{{ lookup('aws_ssm', '/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id', **connection_args) }}"
- name: provision ec2 instance to create an image
ec2_instance:
@@ -146,6 +148,10 @@
modify_targets: no
vpc_id: '{{ setup_vpc.vpc.id }}'
target_type: instance
+ health_check_interval: 5
+ health_check_timeout: 2
+ healthy_threshold_count: 2
+ unhealthy_threshold_count: 2
register: elb_target_group_instance
- name: create second target group to use ip target_type
@@ -157,6 +163,10 @@
modify_targets: no
vpc_id: '{{ setup_vpc.vpc.id }}'
target_type: ip
+ health_check_interval: 5
+ health_check_timeout: 2
+ healthy_threshold_count: 2
+ unhealthy_threshold_count: 2
register: elb_target_group_ip
- name: create load balancer
@@ -618,8 +628,8 @@
assert:
that:
- ecs_service_creation_constraints.changed
- - "{{ ecs_service_creation_constraints.service.placementConstraints | length }} == 1"
- - "{{ ecs_service_creation_constraints.service.placementConstraints[0].type }} == distinctInstance"
+ - "ecs_service_creation_constraints.service.placementConstraints | length == 1"
+ - "ecs_service_creation_constraints.service.placementConstraints[0].type == 'distinctInstance'"
- name: Update ecs service's placement constraints
ecs_service:
@@ -642,9 +652,9 @@
assert:
that:
- ecs_service_update_constraints.changed
- - "{{ ecs_service_update_constraints.service.placementConstraints | length }} == 1"
- - "{{ ecs_service_update_constraints.service.placementConstraints[0].type }} == memberOf"
- - "{{ ecs_service_update_constraints.service.placementConstraints[0].expression }} == 'attribute:ecs.instance-type == t3.micro'"
+ - "ecs_service_update_constraints.service.placementConstraints | length == 1"
+ - "ecs_service_update_constraints.service.placementConstraints[0].type == 'memberOf'"
+ - "ecs_service_update_constraints.service.placementConstraints[0].expression == 'attribute:ecs.instance-type == t3.micro'"
- name: Create ecs service with placement strategy
ecs_service:
@@ -667,9 +677,9 @@
assert:
that:
- ecs_service_creation_strategy.changed
- - "{{ ecs_service_creation_strategy.service.placementplacementStrategy | length }} == 1"
- - "{{ ecs_service_creation_strategy.service.placementConstraints[0].type }} == binpack"
- - "{{ ecs_service_creation_strategy.service.placementConstraints[0].field }} == MEMORY"
+ - "ecs_service_creation_strategy.service.placementplacementStrategy | length == 1"
+ - "ecs_service_creation_strategy.service.placementConstraints[0].type == 'binpack'"
+ - "ecs_service_creation_strategy.service.placementConstraints[0].field == 'MEMORY'"
- name: Update ecs service's placement strategy
ecs_service:
@@ -692,9 +702,9 @@
assert:
that:
- ecs_service_update_strategy.changed
- - "{{ ecs_service_update_strategy.service.placementplacementStrategy | length }} == 1"
- - "{{ ecs_service_update_strategy.service.placementConstraints[0].type }} == spread"
- - "{{ ecs_service_update_strategy.service.placementConstraints[0].field }} == instanceId"
+ - "ecs_service_update_strategy.service.placementplacementStrategy | length == 1"
+ - "ecs_service_update_strategy.service.placementConstraints[0].type == 'spread'"
+ - "ecs_service_update_strategy.service.placementConstraints[0].field == 'instanceId'"
# ============================================================
# Begin tests for Fargate |
changelogs/fragments/1601-ecs_service-support_constraints_and_strategy_update.yml
Outdated
Show resolved
Hide resolved
hi @markuman, thanks for review, updated. |
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
LGTM. |
changelogs/fragments/1601-ecs_service-support_constraints_and_strategy_update.yml
Outdated
Show resolved
Hide resolved
…strategy_update.yml
recheck |
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #1648 🤖 @patchback |
ecs_service supports constraints and strategy update SUMMARY ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_service ADDITIONAL INFORMATION related issue #1414 Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: 周丰 <[email protected]> Reviewed-by: Alina Buzachis <None> (cherry picked from commit 316f0ac)
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #1650 🤖 @patchback |
ecs_service supports constraints and strategy update SUMMARY ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_service ADDITIONAL INFORMATION related issue #1414 Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: 周丰 <[email protected]> Reviewed-by: Alina Buzachis <None> (cherry picked from commit 316f0ac)
[PR #1601/316f0acb backport][stable-5] ecs_service supports constraints and strategy update This is a backport of PR #1601 as merged into main (316f0ac). SUMMARY ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_service ADDITIONAL INFORMATION related issue #1414 Reviewed-by: Markus Bergholz <[email protected]>
[PR #1601/316f0acb backport][stable-4] ecs_service supports constraints and strategy update This is a backport of PR #1601 as merged into main (316f0ac). SUMMARY ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_service ADDITIONAL INFORMATION related issue #1414 Reviewed-by: Markus Bergholz <[email protected]>
…#1605) Update main branch after release 6.1.0 and 6.0.1 SUMMARY Update main branch after release 6.1.0 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mike Graves <[email protected]> Reviewed-by: Helen Bailey <[email protected]>
SUMMARY
ISSUE TYPE
COMPONENT NAME
ecs_service
ADDITIONAL INFORMATION
related issue #1414