Upudate dockerPortMap() in task.go with dynamic host port range support part 2 #39
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.
This is a follow-up PR for Upudate dockerPortMap() in task.go with dynamic host port range support - part 1 to implement dynamic host port assignment for default bridge mode service connect ingress listener ports in
dockerPortMap()
.Comparing to the current Upudate dockerPortMap() in task.go with dynamic host port range support - part 1 PR, main changes in this PR include:
buildPortMapWithSCIngressConfig()
to build a dockerPortMap and a containerPortSet for ingress listener ports under two service connect bridge mode cases:dockerPortMap()
to include service connect ingress listener ports infodockerPortMap()
ResetTracker()
in ephemeral_ports.go to reset the last assigned host port to 0. This function will be used in unit testsTestGetHostPort
,TestGetHostPortRange
andTestDockerHostConfigSCBridgeMode
.TestDockerHostConfigSCBridgeMode
to test changes made in this PR.Implementation details
agent/api/task/task.go
buildPortMapWithSCIngressConfig()
to build a dockerPortMap and a containerPortSet for ingress listener portsdockerPortMap()
agent/api/task/task_test.go
TestDockerHostConfigSCBridgeMode
to test changesagent/utils/ephemeral_ports.go
ResetTracker()
and use it inTestGetHostPort
andTestGetHostPortRange
agent/utils/ephemeral_ports_test.go
ResetTracker()
inTestGetHostPort
andTestGetHostPortRange
TestResetTracker
Testing
New tests cover the changes: yes
Unit test
TestDockerHostConfigSCBridgeMode
TestResetTracker
Manual test
See Upudate dockerPortMap() in task.go with dynamic host port range support - part 1 for container port and container port range testing results.
Description for the changelog
[Enhancement] Support user-specified dynamic host port range for a singular port and default bridge mode service connect ingress listener ports
Related PRs
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.