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.
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
refactor: exposed port validation #5303
refactor: exposed port validation #5303
Changes from 12 commits
881ebe3
a2e5242
52d7cd1
13db40f
b356514
71bdf85
fc6ed62
311f399
573aeb9
d8e215f
d3faec3
66ce171
1e4fd9d
e0bf921
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
just sharing my thought here, this is not a request 👀 I personally would refrain from using the term
target
in the variable names, because up until this point,target
means that a port a) not only is exposed, b) but also functions as a port that receives traffic from an NLB/ALB.A port could be exposed, but only receive traffic from within the task - for example, a sidecar could communicate with another sidecar through a port. These port satisfy a), but not b). They are generally not considered "a target port", because they are not the target of anything.
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.
Is this added so that
populateAndValidateMainContainerPort
works no matter what order it is called in relative to the otherpopulateAndValidateXPort
functions? Based on the order in which these functions are called, it seems likeok
would never betrue
👀 !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.
It's for the case where the NLB specifies a protocol that's not TCP to be used for the main container. In this case the NLB specifies that and it gets populated in the map.
An example manifest:
Without this statement here the program would error out saying
container "mockMainContainer" is exposing the same port 80 with protocol TCP and UDP
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.
oh I just realized you moved the function call from the first to the last! Then I think we are good 👍🏼
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.
I feel like
nlb
is a little different than the other. Without protocol, default protocol fornlb
should be tcp, instead of any protocol that is already exposed. Consider this manifest:I would expect this manifest to error out, honestly. The
nlb.port
being81
means it listens on 81 for TCP port, and route the traffic to port 81 of thenginx
container, and expect that target port to betcp
. However, the same port is already exposed asudp
. So error.I think basically, the question is, when we think of the protocol for
nlb
, do we think of it in a NLB-first way, or a container-first way. My proposal above is NLB-first, the code that I'm commenting on is container-first.