Skip to content
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

Allow default network mode, as required for windows containers. #59597

Merged
merged 10 commits into from Feb 10, 2020

Conversation

ksagle77
Copy link
Contributor

SUMMARY

Windows containers require the network mode. In boto3, this is configured by not passing a network_mode paramter, but this mode is not supported by this module.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

cloud

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Jul 25, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:247:48: trailing-whitespace Trailing whitespace

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:247:49: W291 trailing whitespace

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 25, 2019

@ansibot
Copy link
Contributor

ansibot commented Jul 25, 2019

@ksagle77, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 aws ci_verified Changes made in this PR are causing tests to fail. cloud feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 25, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 8, 2019
@ansibot
Copy link
Contributor

ansibot commented Jan 31, 2020

@xp0
Copy link
Contributor

xp0 commented Feb 5, 2020

This would be really nice to have in the next release

@tremble
Copy link
Contributor

tremble commented Feb 6, 2020

@xp0 @ksagle77

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html seems to show when not set it'll default to 'bridge' which is what this module also does. Could you provide some information to show when / why this is necessary?

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Feb 6, 2020
@ksagle77
Copy link
Contributor Author

ksagle77 commented Feb 6, 2020

@tremble

Hey Mark,

The issue is that docker for windows has it's own networking mode (NAT), which requires that no network mode is selected. Choosing bridge causes it to fail. From https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html:

Docker for Windows uses a different network mode (known as NAT) than Docker for Linux. When you register a task definition with Windows containers, you must not specify a network mode. If you use the AWS Management Console to register a task definition with Windows containers, you must choose the default network mode.

Kevin

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor things here.

  1. Could you add a changelog fragment https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs
  2. Please add something to the description to explain what 'default' does

@@ -62,7 +62,7 @@
- C(awsvpc) mode was added in Ansible 2.5
required: false
default: bridge
choices: [ 'bridge', 'host', 'none', 'awsvpc' ]
choices: [ 'default', 'bridge', 'host', 'none', 'awsvpc' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the effect of 'default' documented in the description above.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Feb 6, 2020
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Feb 6, 2020
@ksagle77
Copy link
Contributor Author

ksagle77 commented Feb 6, 2020

@tremble

Hey Mark,

I've added the change fragment and a description. Let me know if it should be more detailed.

Kevin

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tiny tweaks in the wording, but generally looking good to me.

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py Outdated Show resolved Hide resolved
@ansibot
Copy link
Contributor

ansibot commented Feb 6, 2020

The test ansible-test sanity --test pylint [explain] failed with 2 errors:

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:274:48: trailing-whitespace: Trailing whitespace
lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:336:78: bad-whitespace: Exactly one space required after comma         network_mode=dict(required=False, default='bridge', choices=['default','bridge', 'host', 'none', 'awsvpc'], type='str'),                                                                               ^

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:274:49: W291: trailing whitespace
lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py:336:79: E231: missing whitespace after ','

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Feb 6, 2020
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Feb 6, 2020
lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py Outdated Show resolved Hide resolved
@@ -298,7 +302,7 @@ def main():
revision=dict(required=False, type='int'),
force_create=dict(required=False, default=False, type='bool'),
containers=dict(required=False, type='list'),
network_mode=dict(required=False, default='bridge', choices=['bridge', 'host', 'none', 'awsvpc'], type='str'),
network_mode=dict(required=False, default='bridge', choices=['default','bridge', 'host', 'none', 'awsvpc'], type='str'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
network_mode=dict(required=False, default='bridge', choices=['default','bridge', 'host', 'none', 'awsvpc'], type='str'),
network_mode=dict(required=False, default='bridge', choices=['default', 'bridge', 'host', 'none', 'awsvpc'], type='str'),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, didn't realize that. Adding it back, thanks.

Co-Authored-By: Mark Chappell <mchappel@redhat.com>
Co-Authored-By: Mark Chappell <mchappel@redhat.com>
@tremble
Copy link
Contributor

tremble commented Feb 6, 2020

One last change (removing the duplicate text, unfortunately GitHub doesn't let you make suggestions against multiple lines yet) and then I think we're good to go.

Co-Authored-By: Mark Chappell <mchappel@redhat.com>
@ksagle77
Copy link
Contributor Author

ksagle77 commented Feb 6, 2020

Removed. Thanks for the help.

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 6, 2020
Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tests pass locally, thanks very much for this patch @ksagle77!

@tremble
Copy link
Contributor

tremble commented Feb 7, 2020

LGTM

@tremble
Copy link
Contributor

tremble commented Feb 8, 2020

bot_status

@ansibot
Copy link
Contributor

ansibot commented Feb 8, 2020

Components

changelogs/fragments/59597-ecs-allow_default_network_mode.yml
support: community
maintainers:

lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py
support: community
maintainers: Java1Guy jillr s-hertel tremble

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 1
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainers or core team members): tremble
shipit_actors_other: []
automerge: automerge shipit test failed

click here for bot help

@jillr jillr merged commit b9d22b9 into ansible:devel Feb 10, 2020
href pushed a commit to cloudscale-ch/ansible that referenced this pull request Feb 12, 2020
…ble#59597)

* Allow default network option for network_mode, required for windows containers.

* Add change fragment and param description

* Update changelogs/fragments/59597-ecs-allow_default_network_mode.yml

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Correct descriptions. Remove whitespaces.

* Remove empty line.

* Add single space after comma

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

Co-authored-by: kevinsagle <44478308+kevinsagle@users.noreply.github.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
@ansible ansible locked and limited conversation to collaborators Mar 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 aws cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants