-
Notifications
You must be signed in to change notification settings - Fork 243
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 issue with conflicting ports when starting multiple Dev sessions on Podman #6660
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -782,12 +782,11 @@ func SafeGetBool(b *bool) bool { | |
|
||
// IsPortFree checks if the port on localhost is free to use | ||
func IsPortFree(port int) bool { | ||
address := fmt.Sprintf("localhost:%d", port) | ||
address := fmt.Sprintf("0.0.0.0:%d", port) | ||
listener, err := net.Listen("tcp", address) | ||
if err != nil { | ||
return false | ||
} | ||
_ = listener.Addr().(*net.TCPAddr).Port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be used to determine the port value on which we are listening (by casting |
||
err = listener.Close() | ||
return err == nil | ||
} | ||
|
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.
Should this change be reverted once the regression has been fixed? If so, can you add a todo about it?
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.
To me, this is still valid even after the regression is fixed in the kernel. Podman binds by default to
0.0.0.0
, so it makes sense to check on all addresses. As for Kubernetes, port-forwarding currently binds to127.0.0.1
by default, but it makes sense to me to still check on all addresses.As part of #6479, we would need to properly control the address on which to bind and pass the right address to this function.