Skip to content
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

Merged
merged 1 commit into from
Dec 4, 2017

Conversation

leblancd
Copy link

@leblancd leblancd commented Sep 19, 2017

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 #52746

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 19, 2017
@k8s-github-robot k8s-github-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 19, 2017
@xiangpengzhao
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 20, 2017
@leblancd leblancd force-pushed the v6_e2e_host_port branch 2 times, most recently from cacd5c1 to 4fe9816 Compare September 22, 2017 19:08
@leblancd
Copy link
Author

/test pull-kubernetes-unit

@sttts
Copy link
Contributor

sttts commented Sep 25, 2017

/cc @frobware for IPv6

@k8s-ci-robot
Copy link
Contributor

@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:

/cc @frobware for IPv6

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.

Copy link
Contributor

@frobware frobware left a 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'",
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@@ -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)))
Copy link
Contributor

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.

Copy link
Author

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)
Copy link
Contributor

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?

Copy link
Author

@leblancd leblancd left a 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.

@@ -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)))
Copy link
Author

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'",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@frobware
Copy link
Contributor

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

Of course! My mistake. As you suggest the sprintf is cleaner.

@leblancd leblancd force-pushed the v6_e2e_host_port branch 2 times, most recently from ed2d6fb to 5c5b712 Compare September 25, 2017 14:07
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 28, 2017
@leblancd leblancd mentioned this pull request Oct 6, 2017
@danehans
Copy link

danehans commented Oct 9, 2017

/area ipv6
/sig network

@k8s-ci-robot k8s-ci-robot added area/ipv6 sig/network Categorizes an issue or PR as relevant to SIG Network. labels Oct 9, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2017
@ncdc
Copy link
Member

ncdc commented Oct 12, 2017

/unassign
/assign @danwinship (please reassign to someone else in sig-network as you see fit)

@danwinship
Copy link
Contributor

--globoff has not been needed for IPv6 IP literals since curl 7.37.0 (May 21 2014)

... 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 --globoff, so I think that whether you say --globoff or -g, it's going to be confusing, since there's no apparent globbing in the URLs to worry about. I feel like it would be better to stick with -g (for brevity and for consistency with the other options), but put a comment explaining why it's needed.

Also, git grep '://%s:%' turns up a bunch more places that might need fixing. (Some are false positives but some look like they aren't.)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 19, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2017
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
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 14, 2017
@danehans
Copy link

@bowei @thockin anything else needed to get this PR merged?

@danehans
Copy link

/assign @thockin

@thockin
Copy link
Member

thockin commented Nov 22, 2017

/lgtm
/approve

I want to thank the IPv6 team for consistently producing small, easy to review PRs.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 22, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 22, 2017
@danehans
Copy link

@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.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@bowei
Copy link
Member

bowei commented Dec 4, 2017

/status approved-for-milestone

@bowei
Copy link
Member

bowei commented Dec 4, 2017

/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Dec 4, 2017
@freehan freehan added this to the v1.9 milestone Dec 4, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@leblancd
Copy link
Author

leblancd commented Dec 4, 2017

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 4, 2017
@k8s-github-robot
Copy link

[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.
If this pull request is not being actively worked on, please remove it from the milestone.
If it is being worked on, please add the status/in-progress label so it can be tracked with other in-flight pull requests.

Note: This pull request is marked as priority/critical-urgent, and must be updated every 1 day during code freeze.

Example update:

ACK.  In progress
ETA: DD/MM/YYYY
Risks: Complicated fix required
Pull Request Labels
  • sig/network: Pull Request will be escalated to these SIGs if needed.
  • priority/critical-urgent: Never automatically move pull request out of a release milestone; continually escalate to contributor and SIG through all available channels.
  • kind/feature: New functionality.
Help

@k8s-github-robot
Copy link

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.

@k8s-github-robot k8s-github-robot merged commit f9f8dc3 into kubernetes:master Dec 4, 2017
@k8s-ci-robot
Copy link
Contributor

@leblancd: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-verify 2827b7f link /test pull-kubernetes-verify

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/ipv6 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. milestone/needs-attention priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

e2e tests need to use brackets around IPv6 addresses for IP:port