Allow container port binding for privileged ports#7719
Merged
Conversation
This file contains hidden or 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
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.
Motivation
Currently, we do not allow checking privileged ports to be bound by LS. This leads to a problem with a hostport configuration in ECS for privileged ports - even if they are free.
Also, we are checking for each port we check on the host, if the port is free in the container as well. We should not do this, as we might want to use ports bound inside LS on the host as well.
Changes
reserve_available_container_portand ports which can be reserved on request. Per default, the former only returns non-privileged ports, while the whole port range can be reserved on explicit request for a portRemaining Problems
If checking is_port_available_for_containers before reserving the port, with the new changes, the port check will be done twice, which can lead to reduced performance.
Where possible, we should try reserving and catching the exception, instead of checking if it is possible first.