mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Ecs service add features (#50059)
* Support UpdateService forceNewDeployment in ecs_service module * Fixes for review * Add force_new_deployment option to ecs_service.py cherrypicks changes from via/ansible Adds tests for pull request #42518 fixes backwards compatability with boto<1.8.4 * WIP commit so I don't have to stash * WIP commit for healthcheck grace period * WIP commit; ecs_module handles service registries * Fix bad check for desired_count * Add scheduling strategy test, comment out service registry test * Fix names in ecs_cluster role main task. * move full test run back to the end * Change botocore version for full test to support scheduling strategy * fix bug with desired_count==0 in amazon/ecs_service * Fix changed checking for scheduling strategy DAEMON in ecs_service * Pass testS * Fix some unhelpful comments * Add changelog for ecs_service
This commit is contained in:
committed by
Will Thames
parent
9474f81507
commit
b538e34a32
@@ -479,6 +479,95 @@
|
||||
- "update_ecs_service_with_vpc.service.networkConfiguration.awsvpcConfiguration.subnets|length == 2"
|
||||
- "update_ecs_service_with_vpc.service.networkConfiguration.awsvpcConfiguration.securityGroups|length == 1"
|
||||
|
||||
- name: create ecs_service using health_check_grace_period_seconds
|
||||
ecs_service:
|
||||
name: "{{ ecs_service_name }}-mft"
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
load_balancers:
|
||||
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
containerName: "{{ ecs_task_name }}"
|
||||
containerPort: "{{ ecs_task_container_port }}"
|
||||
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
scheduling_strategy: "REPLICA"
|
||||
health_check_grace_period_seconds: 10
|
||||
desired_count: 1
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: ecs_service_creation_hcgp
|
||||
|
||||
|
||||
- name: health_check_grace_period_seconds sets HealthChecGracePeriodSeconds
|
||||
assert:
|
||||
that:
|
||||
- ecs_service_creation_hcgp.changed
|
||||
- "{{ecs_service_creation_hcgp.service.healthCheckGracePeriodSeconds}} == 10"
|
||||
|
||||
- name: update ecs_service using health_check_grace_period_seconds
|
||||
ecs_service:
|
||||
name: "{{ ecs_service_name }}-mft"
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
load_balancers:
|
||||
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
containerName: "{{ ecs_task_name }}"
|
||||
containerPort: "{{ ecs_task_container_port }}"
|
||||
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
desired_count: 1
|
||||
health_check_grace_period_seconds: 30
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: ecs_service_creation_hcgp2
|
||||
ignore_errors: no
|
||||
|
||||
- name: check that module returns success
|
||||
assert:
|
||||
that:
|
||||
- ecs_service_creation_hcgp2.changed
|
||||
- "{{ecs_service_creation_hcgp2.service.healthCheckGracePeriodSeconds}} == 30"
|
||||
|
||||
# until ansible supports service registries, this test can't run.
|
||||
# - name: update ecs_service using service_registries
|
||||
# ecs_service:
|
||||
# name: "{{ ecs_service_name }}-service-registries"
|
||||
# cluster: "{{ ecs_cluster_name }}"
|
||||
# load_balancers:
|
||||
# - targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
# containerName: "{{ ecs_task_name }}"
|
||||
# containerPort: "{{ ecs_task_container_port }}"
|
||||
# service_registries:
|
||||
# - containerName: "{{ ecs_task_name }}"
|
||||
# containerPort: "{{ ecs_task_container_port }}"
|
||||
# ### TODO: Figure out how to get a service registry ARN without a service registry module.
|
||||
# registryArn: "{{ ecs_task_service_registry_arn }}"
|
||||
# task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
# desired_count: 1
|
||||
# state: present
|
||||
# <<: *aws_connection_info
|
||||
# register: ecs_service_creation_sr
|
||||
# ignore_errors: yes
|
||||
|
||||
# - name: dump sr output
|
||||
# debug: var=ecs_service_creation_sr
|
||||
|
||||
# - name: check that module returns success
|
||||
# assert:
|
||||
# that:
|
||||
# - ecs_service_creation_sr.changed
|
||||
|
||||
- name: update ecs_service using REPLICA scheduling_strategy
|
||||
ecs_service:
|
||||
name: "{{ ecs_service_name }}-replica"
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
load_balancers:
|
||||
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
containerName: "{{ ecs_task_name }}"
|
||||
containerPort: "{{ ecs_task_container_port }}"
|
||||
scheduling_strategy: "REPLICA"
|
||||
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
desired_count: 1
|
||||
state: present
|
||||
<<: *aws_connection_info
|
||||
register: ecs_service_creation_replica
|
||||
|
||||
- name: obtain facts for all ECS services in the cluster
|
||||
ecs_service_facts:
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
@@ -728,6 +817,56 @@
|
||||
ignore_errors: yes
|
||||
register: ecs_service_scale_down
|
||||
|
||||
- name: scale down multifunction-test service
|
||||
ecs_service:
|
||||
name: "{{ ecs_service_name }}-mft"
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
state: present
|
||||
load_balancers:
|
||||
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
containerName: "{{ ecs_task_name }}"
|
||||
containerPort: "{{ ecs_task_container_port }}"
|
||||
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
desired_count: 0
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
register: ecs_service_scale_down
|
||||
|
||||
|
||||
|
||||
- name: scale down scheduling_strategy service
|
||||
ecs_service:
|
||||
name: "{{ ecs_service_name }}-replica"
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
state: present
|
||||
load_balancers:
|
||||
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
containerName: "{{ ecs_task_name }}"
|
||||
containerPort: "{{ ecs_task_container_port }}"
|
||||
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
desired_count: 0
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
register: ecs_service_scale_down
|
||||
|
||||
|
||||
# until ansible supports service registries, the test for it can't run and this
|
||||
# scale down is not needed
|
||||
# - name: scale down service_registries service
|
||||
# ecs_service:
|
||||
# name: "{{ ecs_service_name }}-service-registries"
|
||||
# cluster: "{{ ecs_cluster_name }}"
|
||||
# state: present
|
||||
# load_balancers:
|
||||
# - targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
|
||||
# containerName: "{{ ecs_task_name }}"
|
||||
# containerPort: "{{ ecs_task_container_port }}"
|
||||
# task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
|
||||
# desired_count: 0
|
||||
# <<: *aws_connection_info
|
||||
# ignore_errors: yes
|
||||
# register: ecs_service_scale_down
|
||||
|
||||
- name: scale down Fargate ECS service
|
||||
ecs_service:
|
||||
state: present
|
||||
@@ -761,6 +900,32 @@
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
|
||||
- name: remove mft ecs service
|
||||
ecs_service:
|
||||
state: absent
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
name: "{{ ecs_service_name }}-mft"
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
|
||||
- name: remove scheduling_strategy ecs service
|
||||
ecs_service:
|
||||
state: absent
|
||||
cluster: "{{ ecs_cluster_name }}"
|
||||
name: "{{ ecs_service_name }}-replica"
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
|
||||
# until ansible supports service registries, the test for it can't run and this
|
||||
# removal is not needed
|
||||
# - name: remove service_registries ecs service
|
||||
# ecs_service:
|
||||
# state: absent
|
||||
# cluster: "{{ ecs_cluster_name }}"
|
||||
# name: "{{ ecs_service_name }}-service-registries"
|
||||
# <<: *aws_connection_info
|
||||
# ignore_errors: yes
|
||||
|
||||
- name: remove fargate ECS service
|
||||
ecs_service:
|
||||
state: absent
|
||||
@@ -769,7 +934,7 @@
|
||||
<<: *aws_connection_info
|
||||
ignore_errors: yes
|
||||
register: ecs_fargate_service_network_with_awsvpc
|
||||
|
||||
|
||||
- name: remove ecs task definition
|
||||
ecs_taskdefinition:
|
||||
containers: "{{ ecs_task_containers }}"
|
||||
|
||||
@@ -12,6 +12,8 @@ trap 'rm -rf "${MYTMPDIR}"' EXIT
|
||||
# but for the python3 tests we need virtualenv to use python3
|
||||
PYTHON=${ANSIBLE_TEST_PYTHON_INTERPRETER:-python}
|
||||
|
||||
|
||||
|
||||
# Test graceful failure for older versions of botocore
|
||||
virtualenv --system-site-packages --python "${PYTHON}" "${MYTMPDIR}/botocore-1.7.40"
|
||||
source "${MYTMPDIR}/botocore-1.7.40/bin/activate"
|
||||
@@ -42,5 +44,5 @@ ansible-playbook -i ../../inventory -e @../../integration_config.yml -e @../../c
|
||||
# Run full test suite
|
||||
virtualenv --system-site-packages --python "${PYTHON}" "${MYTMPDIR}/botocore-recent"
|
||||
source "${MYTMPDIR}/botocore-recent/bin/activate"
|
||||
$PYTHON -m pip install 'botocore>=1.8.4' boto3
|
||||
$PYTHON -m pip install 'botocore>=1.10.37' boto3 # version 1.10.37 for scheduling strategy
|
||||
ansible-playbook -i ../../inventory -e @../../integration_config.yml -e @../../cloud-config-aws.yml -v playbooks/full_test.yml "$@"
|
||||
|
||||
Reference in New Issue
Block a user