-
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_taskdefinition: ensure cast to integer and idempotency fix #574
ecs_taskdefinition: ensure cast to integer and idempotency fix #574
Conversation
I get an error with this branch when using
Adding some casts fixes it. Not sure if it would be better to do inline or ensure that container has the ints.
|
237156e
to
6e9ea70
Compare
Oh, that's true. It's missing the cast to int there. I fix it right now. Thank you for trying it and letting me know. Can you try again please? Thanks. |
That works for me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits, otherwise looks good to me.
for param in ('maxSwap', 'swappiness', 'sharedMemorySize'): | ||
if param in linux_param: | ||
container['linuxParameters'][param] = int(container['linuxParameters'][param]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for param in ('maxSwap', 'swappiness', 'sharedMemorySize'): | |
if param in linux_param: | |
container['linuxParameters'][param] = int(container['linuxParameters'][param]) | |
if linux_param in ('maxSwap', 'swappiness', 'sharedMemorySize'):` | |
container['linuxParameters'][param] = int(container['linuxParameters'][param]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markuman Thank you for reviewing. I used the for loop here because I need to cast to int all these parameters ('maxSwap', 'swappiness', 'sharedMemorySize')
. The user can use all together.
for limits_mapping in container['ulimits']: | ||
for limit in ('softLimit', 'hardLimit'): | ||
if limit in limits_mapping: | ||
limits_mapping[limit] = int(limits_mapping[limit]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for limits_mapping in container['ulimits']: | |
for limit in ('softLimit', 'hardLimit'): | |
if limit in limits_mapping: | |
limits_mapping[limit] = int(limits_mapping[limit]) | |
for limits_mapping in container['ulimits']: | |
for limit in ('softLimit', 'hardLimit'): | |
if limit == limits_mapping: | |
limits_mapping[limit] = int(limits_mapping[limit]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markuman limits_mapping
is a dict, for this reason I used if limit in limits_mapping
.
module.fail_json(msg='maxSwap parameter is not supported with the FARGATE launch type.') | ||
elif linux_param.get('maxSwap') and linux_param['maxSwap'] < 0: | ||
elif linux_param == 'maxSwap' and int(container['linuxParameters']['maxSwap']) < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happen if key maxSwap
does not exist? Is it possible? I've no idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for swappiness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markuman maxSwap
and swappiness
are optional and they can be specified within linuxParameters
. If this is what you meant. This flow here is only executed when the parameters are specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This shoud be merged before next release. Because it fixes more than the known issue. containers:
- name: somename
linuxParameters:
capabilities:
add:
- NET_BIND_SERVICE Currently it results in
This PR fixes also this case. Maybe the integrationtest should also include something like ecs_task_containers_with_linux_parameters:
- name: "{{ ecs_task_name }}"
image: "{{ ecs_task_image_path }}"
essential: true
memory: "{{ ecs_task_memory }}"
linuxParameters:
capabilities:
add:
- NET_BIND_SERVICE
portMappings:
- containerPort: "{{ ecs_task_container_port }}"
hostPort: "{{ ecs_task_host_port|default(0) }}"
mountPoints: "{{ ecs_task_mount_points|default([]) }}" fyi @alinabuzachis @jillr |
@@ -190,7 +192,7 @@ | |||
linuxParameters: | |||
description: Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. | |||
required: False | |||
type: list | |||
type: dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's going from a list of dicts to a dict, is this not a breaking change? (Although I guess we can do this with 2.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Imho) it never worked as a list
. I guess it was one of the transformation errors when elements
where introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alinabuzachis This lgtm, could you please add a changelog? As tremble noted we should call out that linuxParameters
requires a dict (and that list
was a bug that never worked)
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
Signed-off-by: Alina Buzachis <[email protected]>
6e9ea70
to
5ec234e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
) [3.0.0] Bump minimal botocore version to 1.19.0 SUMMARY In preparation for release 3.0.0, bump the minimal botocore version ISSUE TYPE Feature Pull Request COMPONENT NAME README.md plugins/doc_fragments/aws.py plugins/lookup/aws_account_attribute.py plugins/lookup/aws_secret.py plugins/lookup/aws_ssm.py plugins/module_utils/core.py plugins/modules/s3_bucket.py requirements.txt tests/integration/constraints.txt tests/integration/targets/setup_botocore_pip/defaults/main.yml tests/unit/constraints.txt tests/unit/module_utils/core/ansible_aws_module/test_minimal_versions.py ADDITIONAL INFORMATION botocore $ git show 1.19.0 tag 1.19.0 Tagger: aws-sdk-python-automation <[email protected]> Date: Mon Oct 19 18:09:03 2020 +0000 Tagging 1.19.0 release. boto3 $ git show 1.16.0 tag 1.16.0 Tagger: aws-sdk-python-automation <[email protected]> Date: Mon Oct 19 18:08:56 2020 +0000 Tagging 1.16.0 release. Reviewed-by: Alina Buzachis <None> Reviewed-by: None <None>
SUMMARY
ecs_taskdefinition: Ensure cast to integer and fix taskdefinition creation idempotency.
Fixes: #570
ISSUE TYPE
COMPONENT NAME
ecs_taskdefinition