-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Use net.Listen func to ensure the port is free #6990
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @boxjan! |
Hi @boxjan. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @ElvinEfendi |
/assign @cmluciano |
/ok-to-test |
@@ -29,12 +29,12 @@ func IsIPV6(ip _net.IP) bool { | |||
|
|||
// IsPortAvailable checks if a TCP port is available or not | |||
func IsPortAvailable(p int) bool { | |||
conn, err := _net.Dial("tcp", fmt.Sprintf(":%v", p)) | |||
ln, err := _net.Listen("tcp", fmt.Sprintf(":%v", p)) |
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.
Cant it be a problem if we try to bind nginx to a specific IP, but here you check all the interfaces?
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.
https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#bind-address <- we should probably check against this address specifically:
- If it does not exists, we may try binding to every address
- If this exists, then we should try to bind specifically to this address
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.
Yes, you are right, I just did a workaround let it can run in my cluster. I will try to change it under your suggested.
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.
@rikatz but the function was use in init check, so it will change so many things.
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.
hum indeed, this value is in ConfigMap and it's not a flag...
OK, so overall this problem would still happen if we have something listening in the port, I think we can go forward with this one.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: boxjan, rikatz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is it possible to backport this PR to 0.48.x? |
Co-authored-by: boxjan <[email protected]>
) Co-authored-by: boxjan <[email protected]>
What this PR does / why we need it:
Fro the issue, I meet the problem here #6988 ; and I fixed it after I change the judgment method.
Types of changes
Which issue/s this PR fixes
#6988
How Has This Been Tested?
I make a image and deploy it in my cluster which I meet the problem in the issue, then the problem disappeared. I reboot some node, and the problem no happen again.
My image link (docker hub)
Checklist: