-
Notifications
You must be signed in to change notification settings - Fork 617
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
Remove fallback to Docker for host port ranges assignment #3569
Conversation
a2269ea
to
a03d910
Compare
does this need to be changed as well? amazon-ecs-agent/agent/api/task/task.go Line 1817 in a03d910
|
I think with Yash's last PR, we still need those dockerExposedPorts() injections, but just that the comment is no longer a valid one? |
Yes, no change required in |
a03d910
to
b4be907
Compare
b4be907
to
21e1050
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.
Great writeup for the PR!
Summary
Starting from ECS Agent version
1.68.0
, users can specify containerPortRange at ECS task level, andECS_DYNAMIC_HOST_PORT_RANGE
at the container instance level to customize 1:1 container-host port mappings for their applications.With the configured environment variable
ECS_DYNAMIC_HOST_PORT_RANGE
, ECS Agent will try to find a set of contiguous host ports within the given range. As users are expected to have ports to be bound in the customized range, errors should be returned instead of falling back for Docker to process dynamic port assignment if a set of contiguous host ports cannot be found by ECS Agent; therefore, this PR removes the Docker fallback mechanism when a set of contiguous host ports cannot be found by ECS Agent.Issue
Scenario:
ECS_DYNAMIC_HOST_PORT_RANGE
is set, but host ports within the given range are not available for a bridge network mode task to bind it's container ports specified in thecontainerPortRange
field.Reason HostConfigError: error retrieving docker port map: 2 contiguous host ports unavailable
networkBindings
is empty, and ecs-agent.log showslevel=error msg="Unable to find contiguous host ports for container, falling back to docker dynamic port assignment" container="xxx" containerPortRange="8085-8086" error="2 contiguous host ports unavailable" task="xxx"
Setup
hostPortRange
returned from ecs describe-tasks call is within the givenECS_DYNAMIC_HOST_PORT_RANGE
value.hostPortRange
returned from ecs describe-tasks call is empty.Implementation details
containerPortRange
case, return nil as docker port map along with an error indockerPortMap()
when a set of contiguous host ports cannot be found by ECS Agent.dockerPortMap()
Testing
New tests cover the changes: no
Description for the changelog
Bug - Remove fallback to Docker for host port ranges assignment
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.