-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Add brackets around IPv6 addrs in e2e test IP:port endpoints #52748
Conversation
/ok-to-test |
cacd5c1
to
4fe9816
Compare
/test pull-kubernetes-unit |
/cc @frobware for IPv6 |
@sttts: GitHub didn't allow me to request PR reviews from the following users: frobware, for, IPv6. Note that only kubernetes members can review this PR, and authors cannot review their own PRs. 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. |
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'll assume that given the switch to --globoff that we know of no other meta-character uses in the remainder of the URL.
containerIP, | ||
containerHttpPort, | ||
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHttpPort)) | ||
cmd := fmt.Sprintf("curl -g -q -s 'http://%s/dial?request=hostName&protocol=%s&host=%s&port=%d&tries=1'", |
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.
In scripts (and command lines like these) I think it is better to be explicit, so --globoff
instead of -g
. It may save you one lookup to the man page as you later try to recall what -g
does.
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.
Will do.
test/images/nettest/nettest.go
Outdated
@@ -278,7 +280,8 @@ func getWebserverEndpoints(client clientset.Interface) sets.String { | |||
for _, ss := range endpoints.Subsets { | |||
for _, a := range ss.Addresses { | |||
for _, p := range ss.Ports { | |||
eps.Insert(fmt.Sprintf("http://%s:%d", a.IP, p.Port)) | |||
ipPort := net.JoinHostPort(a.IP, strconv.Itoa(int(p.Port))) |
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.
As we already do int(p.Port)
just pass this directly to net.JoinHostPort()
. The strconv.Itoa()
is not necessary.
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.
p.Port in this case is an int32. The int(p.Port) is an intermediate conversion from int32 to int, since strconv.Itoa() won't take int32 directly. I could use fmt.Sprint(p.Port), if the double conversion is misleading.
@@ -70,7 +72,9 @@ func (f *FederationAPIFixture) SetUpWithRunOptions(t *testing.T, runOptions *opt | |||
t.Fatal(err) | |||
} | |||
|
|||
f.Host = fmt.Sprintf("http://%s:%d", runOptions.InsecureServing.BindAddress, runOptions.InsecureServing.BindPort) | |||
port := strconv.Itoa(runOptions.InsecureServing.BindPort) | |||
hostPort := net.JoinHostPort(runOptions.InsecureServing.BindAddress, port) |
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.
Consistency: It seems that the other changes refer to this as ipPort
- why not here too?
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.
@frobware : The 2 places where --globoff is being added do not have any square brackets or curly braces besides the possible IPv6 address.
test/images/nettest/nettest.go
Outdated
@@ -278,7 +280,8 @@ func getWebserverEndpoints(client clientset.Interface) sets.String { | |||
for _, ss := range endpoints.Subsets { | |||
for _, a := range ss.Addresses { | |||
for _, p := range ss.Ports { | |||
eps.Insert(fmt.Sprintf("http://%s:%d", a.IP, p.Port)) | |||
ipPort := net.JoinHostPort(a.IP, strconv.Itoa(int(p.Port))) |
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.
p.Port in this case is an int32. The int(p.Port) is an intermediate conversion from int32 to int, since strconv.Itoa() won't take int32 directly. I could use fmt.Sprint(p.Port), if the double conversion is misleading.
containerIP, | ||
containerHttpPort, | ||
ipPort := net.JoinHostPort(containerIP, strconv.Itoa(containerHttpPort)) | ||
cmd := fmt.Sprintf("curl -g -q -s 'http://%s/dial?request=hostName&protocol=%s&host=%s&port=%d&tries=1'", |
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.
Will do.
4fe9816
to
3afd48b
Compare
Of course! My mistake. As you suggest the sprintf is cleaner. |
ed2d6fb
to
5c5b712
Compare
/area ipv6 |
5c5b712
to
01c65ff
Compare
/unassign |
... which is newer than what's in RHEL7. Sigh. OK. Well, anyway, neither the old nor new man pages mention anything about IPv6 in the documentation for Also, |
There are several locations in the e2e tests where endpoints of the form IP:port use IPv6 addresses directly, without surrounding brackets. Brackets are required around IPv6 addresses in this case, in order to distinguish the colons in the IPv6 address from the colon immediately preceding the port. Also, wherever the curl command might be used with an IPv6 address surrounded in brackets, the "-g" argument is added to the curl command line arguments so that the brackets can be interpreted correctly. fixes kubernetes#52746
bf7f760
to
2827b7f
Compare
/assign @thockin |
/lgtm I want to thank the IPv6 team for consistently producing small, easy to review PRs. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: leblancd, pmichali, thockin Associated issue: 52746 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@thockin thank you! I see this PR has not merged b/c the submit queue states "Milestone is for a future release and cannot be merged". Correct me if I'm wring, but I assume this PR will not get merged until the 1.10 cycle. |
/retest Review the full test history for this PR. |
/status approved-for-milestone |
/priority critical-urgent |
/test all [submit-queue is verifying that this PR is safe to merge] |
/kind feature |
[MILESTONENOTIFIER] Milestone Pull Request Needs Attention @danwinship @leblancd @pmichali @sttts @thockin @kubernetes/sig-network-misc Action required: During code freeze, pull requests in the milestone should be in progress. Note: This pull request is marked as Example update:
Pull Request Labels
|
Automatic merge from submit-queue (batch tested with PRs 52748, 56623). If you want to cherry-pick this change to another branch, please follow the instructions here. |
@leblancd: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
There are several locations in the e2e tests where endpoints of the
form IPv6:port use IPv6 addresses directly, without surrounding brackets.
Brackets are required around IPv6 addresses in this case, in order to
distinguish the colons in the IPv6 address from the colon immediately
preceding the port.
Also, wherever the curl command might be used with an IPv6 address
surrounded in brackets, the "-g" argument is added to the curl
command line arguments so that the brackets can be interpreted
correctly.
fixes #52746
What this PR does / why we need it:
This PR adds brackets around IPv6 addresses when they appear as part of an IPv6-addr:port endpoint
in the e2e tests. This is needed because any connections that attempt to use IPv6-addr:port
endpoint without brackets surrounding the IPv6-addr will fail.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #52746Special notes for your reviewer:
Release note: