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
Fix auto-allocated ports conflicting with explicitly specified ports on service create #93922
Conversation
/cc @liggitt |
nice catch |
6de5593
to
1709887
Compare
@liggitt Now that this PR actually fixes a bug, is it OK to add a release note? |
/hold |
@liggitt I think adding tests that describes our expected behavior might be a good start, so I add some tests in 88d4926, and it turns out the problem you pointed out at #93922 (comment) actually exists. |
cd1dbe1
to
704b9d2
Compare
9484aea
to
dfe481b
Compare
dfe481b
to
ef97435
Compare
Signed-off-by: knight42 <anonymousknight96@gmail.com>
ef97435
to
a19fc51
Compare
|
||
const count = 3 | ||
// The `PortAllocator` seems to allocate the first port randomly, | ||
// So we run the test multiple times to ensure the NodePort is correctly allocated. |
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.
The code change seems good, but I am not sure I understand this random + retry. Can you help me understand?
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.
The port allocator would allocate port randomly from the available ports, if we did not retry, the port allocator might happen to allocate the right port and the test got passed.
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-contributor-experience at kubernetes/community. |
@fejta-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: knight42 anonymousknight96@gmail.com
What type of PR is this?
/kind flake
/kind bug
What this PR does / why we need it:
I added the following debugging:
and got:
The log shows the root cause is the randomly generated health check nodePort happens to be the same as the service nodePort allocated later.
The flake also uncovers a bug that apiserver could potenially allocate a same port as the user-specified HealthCheck NodePort to be the Service NodePort when creating
NodePort
orLoadBalancer
Service.Which issue(s) this PR fixes:
xref: #93605 (comment)
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: