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 an ENV to control ipv6 behavior in the router #15229

Merged
merged 1 commit into from
Jul 21, 2017

Conversation

knobunc
Copy link
Contributor

@knobunc knobunc commented Jul 16, 2017

This patch adds an environent variable called ROUTER_IP_V4_V6_MODE
which must be set to "v4" (the default), "v6", or "v4v6" to control
whether the router to binds to IPv4, IPv6, or both.

Note that when set to 'v6' or 'v4v6', the X-Forwarded-For and
Forwarded http headers will be in IPv6 form (even when the connection
was an IPv4 one, if set to 'v4v6').

Fixes bug 1471255 (https://bugzilla.redhat.com/show_bug.cgi?id=1471255)

@knobunc
Copy link
Contributor Author

knobunc commented Jul 16, 2017

I am working on adding tests that can inspect the headers. [done]

I also need to create a docs PR.

I'm not sure about the name of the environment variable. Would it be better to have a variable named "ROUTER_IP_VERSION" and have it take "v4" (the default), "v6", "v4v6"?

@openshift/networking PTAL

@smarterclayton
Copy link
Contributor

smarterclayton commented Jul 16, 2017 via email

@knobunc
Copy link
Contributor Author

knobunc commented Jul 17, 2017

[test]

@knobunc
Copy link
Contributor Author

knobunc commented Jul 17, 2017

@smarterclayton Right now it is a bool. With the current flag, we always bind IPv4, but allow control of whether to do v4 and v6. When I was putting the PR together I wondered if the semantics of the multi-way are a little more understandable.

I'm not sure about ROUTER_IP_MODE... I'll think about it a little, but at the moment it doesn't scream "look here for IPv6 support".

@smarterclayton
Copy link
Contributor

smarterclayton commented Jul 17, 2017 via email

{{- else }}
bind :{{env "ROUTER_SERVICE_HTTP_PORT" "80"}}
{{- end }}
{{- if matchPattern "true|TRUE" (env "ROUTER_USE_PROXY_PROTOCOL" "") }} accept-proxy{{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this indentation intended?
it does not seem to be part of a block

@@ -199,7 +204,9 @@ frontend public
# determined by the next backend in the chain which may be an app backend (passthrough termination) or a backend
# that terminates encryption in this router (edge)
frontend public_ssl
bind :::{{env "ROUTER_SERVICE_HTTPS_PORT" "443"}} v4v6 {{ if matchPattern "true|TRUE" (env "ROUTER_USE_PROXY_PROTOCOL" "") }} accept-proxy{{ end }}
bind :::{{env "ROUTER_SERVICE_HTTPS_PORT" "443"}}
{{- if matchPattern "true|TRUE" (env "ROUTER_ALLOW_IPV6" "")}} v4v6 {{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach is different than the one used for the port 80 in which the if sentence add the whole bind statement and in here it only adds the "v4v6" option to it.
It might be better to keep them consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! Thanks. I had them both this way before and then realized there was a problem (we needed to lose the :: as well). Then forgot to change both places.

@knobunc knobunc force-pushed the bug/bz1471255-ipv6-env branch 3 times, most recently from bbc9de8 to 522aa47 Compare July 17, 2017 20:24
Copy link
Contributor

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

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

+1 to ROUTER_IP_V4_V6_MODE
Rest looks fine.

This patch adds an environent variable called ROUTER_IP_V4_V6_MODE
which must be set to "v4" (the default), "v6", or "v4v6" to control
whether the router to binds to IPv4, IPv6, or both.

Note that when set to 'v6' or 'v4v6', the X-Forwarded-For and
Forwarded http headers will be in IPv6 form (even when the connection
was an IPv4 one, if set to 'v4v6').

Fixes bug 1471255 (https://bugzilla.redhat.com/show_bug.cgi?id=1471255)
@knobunc
Copy link
Contributor Author

knobunc commented Jul 19, 2017

Added test cases @openshift/networking PTAL

Copy link
Contributor

@pecameron pecameron left a comment

Choose a reason for hiding this comment

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

+1 to ROUTER_IP_V4_V6_MODE
Are you thinking of a command line option?
LGTM

@knobunc
Copy link
Contributor Author

knobunc commented Jul 19, 2017

[testextended][extended: networking]

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to 7821bd5

@eparis
Copy link
Member

eparis commented Jul 19, 2017

ben, feel free to merge on clean test.

knobunc added a commit to knobunc/origin that referenced this pull request Jul 19, 2017
This patch adds an environent variable called ROUTER_IP_V4_V6_MODE
which must be set to "v4" (the default), "v6", or "v4v6" to control
whether the router to binds to IPv4, IPv6, or both.

Note that when set to 'v6' or 'v4v6', the X-Forwarded-For and
Forwarded http headers will be in IPv6 form (even when the connection
was an IPv4 one, if set to 'v4v6').

Back-port of openshift#15229

Fixes bug 1472976 (https://bugzilla.redhat.com/show_bug.cgi?id=1472976)
@knobunc knobunc removed this from the 3.6.0 milestone Jul 19, 2017
@knobunc
Copy link
Contributor Author

knobunc commented Jul 19, 2017

[test] last flaked on #15024

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended/882/) (Base Commit: 3bb18b6) (PR Branch Commit: 7821bd5) (Extended Tests: networking)

@knobunc
Copy link
Contributor Author

knobunc commented Jul 20, 2017

[test] last flaked on #15337

@knobunc
Copy link
Contributor Author

knobunc commented Jul 20, 2017

[merge] This has passed each test cleanly... just not on the same run. i.e. each run has flaked in different places.

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 7821bd5

@knobunc
Copy link
Contributor Author

knobunc commented Jul 20, 2017

[test] flaked on #15351

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 7821bd5

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/3354/) (Base Commit: d784563) (PR Branch Commit: 7821bd5)

@openshift-bot
Copy link
Contributor

openshift-bot commented Jul 21, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1330/) (Base Commit: fb4423b) (PR Branch Commit: 7821bd5) (Image: devenv-rhel7_6469)

@openshift-bot openshift-bot merged commit 137d702 into openshift:master Jul 21, 2017
@knobunc knobunc deleted the bug/bz1471255-ipv6-env branch July 21, 2017 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants