-
Notifications
You must be signed in to change notification settings - Fork 618
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
[DHPA] Add GetHostPort() and update unit tests #3570
Merged
chienhanlin
merged 1 commit into
aws:feature/dynamicHostPortAssignment
from
chienhanlin:getHostPort
Feb 15, 2023
Merged
[DHPA] Add GetHostPort() and update unit tests #3570
chienhanlin
merged 1 commit into
aws:feature/dynamicHostPortAssignment
from
chienhanlin:getHostPort
Feb 15, 2023
+122
−3
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chienhanlin
changed the title
[DynamicHostPortAssignment] Add GetHostPort() and update unit tests
[DHPA] Add GetHostPort() and update unit tests
Feb 14, 2023
YashdalfTheGray
previously approved these changes
Feb 14, 2023
agent/utils/ephemeral_ports.go
Outdated
Comment on lines
115
to
120
numberOfPorts := 1 | ||
result, err := getHostPortsWithRange(numberOfPorts, protocol, dynamicHostPortRange) | ||
if err == nil { | ||
result = strings.Split(result, "-")[0] | ||
} | ||
return result, err |
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.
Nice! Also, wanted to call out that you gave the 1
a name so that it's clear what it is.
singholt
reviewed
Feb 15, 2023
chienhanlin
force-pushed
the
getHostPort
branch
from
February 15, 2023 18:01
6d24b42
to
0e3556e
Compare
singholt
approved these changes
Feb 15, 2023
YashdalfTheGray
approved these changes
Feb 15, 2023
This was referenced Feb 16, 2023
Merged
chienhanlin
added a commit
that referenced
this pull request
Mar 2, 2023
1. Add GetHostPort() and update unit tests #3570 2. Upudate dockerPortMap() in task.go with dynamic host port range support part 1 #3584 3. Upudate dockerPortMap() in task.go with dynamic host port range support part 2 #3589 4. Validate the host port/host port range found by ECS Agent before returning it #3589
chienhanlin
added a commit
to chienhanlin/amazon-ecs-agent
that referenced
this pull request
Mar 4, 2023
1. Add GetHostPort() and update unit tests aws#3570 2. Upudate dockerPortMap() in task.go with dynamic host port range support part 1 aws#3584 3. Upudate dockerPortMap() in task.go with dynamic host port range support part 2 aws#3589 4. Validate the host port/host port range found by ECS Agent before returning it aws#3589 5. Refactor buildPortMapWithSCIngressConfig() in task.go aws#3600
chienhanlin
added a commit
that referenced
this pull request
Mar 6, 2023
1. Add GetHostPort() and update unit tests #3570 2. Upudate dockerPortMap() in task.go with dynamic host port range support part 1 #3584 3. Upudate dockerPortMap() in task.go with dynamic host port range support part 2 #3589 4. Validate the host port/host port range found by ECS Agent before returning it #3589 5. Refactor buildPortMapWithSCIngressConfig() in task.go #3600
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
DHPA - Dynamic Host Port Assignment
The target branch of this PR is feature/dynamicHostPortAssignment.
A new function
GetHostPort()
is added to ephemeral_ports.go to get a singular host port within the givendynamicHostPortRange
range. This change is a part of works to make ECS Agent selects a host port/host port range and passes it to Docker as default behavior.dynamicHostPortRange
can be configured by users using ECS Agent environment variable ECS_DYNAMIC_HOST_PORT_RANGE; if the customized value is not provided, ECS Agent will use the default value returned from GetDynamicHostPortRange() in the utils package.Implementation details
GetHostPort()
getNumOfHostPorts()
GetHostPort()
Testing
New tests cover the changes: yes
An example of debug log when the port is unavailable
Description for the changelog
N/A
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.