-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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
Option to enable http2 on client connections. #25280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,9 @@ import ( | |
"os" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/golang/glog" | ||
"golang.org/x/net/http2" | ||
) | ||
|
||
// IsProbableEOF returns true if the given error resembles a connection termination | ||
|
@@ -53,9 +56,9 @@ func IsProbableEOF(err error) bool { | |
|
||
var defaultTransport = http.DefaultTransport.(*http.Transport) | ||
|
||
// SetTransportDefaults applies the defaults from http.DefaultTransport | ||
// SetOldTransportDefaults applies the defaults from http.DefaultTransport | ||
// for the Proxy, Dial, and TLSHandshakeTimeout fields if unset | ||
func SetTransportDefaults(t *http.Transport) *http.Transport { | ||
func SetOldTransportDefaults(t *http.Transport) *http.Transport { | ||
if t.Proxy == nil || isDefault(t.Proxy) { | ||
// http.ProxyFromEnvironment doesn't respect CIDRs and that makes it impossible to exclude things like pod and service IPs from proxy settings | ||
// ProxierWithNoProxyCIDR allows CIDR rules in NO_PROXY | ||
|
@@ -70,6 +73,19 @@ func SetTransportDefaults(t *http.Transport) *http.Transport { | |
return t | ||
} | ||
|
||
// SetTransportDefaults applies the defaults from http.DefaultTransport | ||
// for the Proxy, Dial, and TLSHandshakeTimeout fields if unset | ||
func SetTransportDefaults(t *http.Transport) *http.Transport { | ||
t = SetOldTransportDefaults(t) | ||
// Allow HTTP2 clients but default off for now | ||
if s := os.Getenv("ENABLE_HTTP2"); len(s) > 0 { | ||
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. /cc @jeremyeder @mffiedler FYI. New option to reduce connection counts, defaulted off. |
||
if err := http2.ConfigureTransport(t); err != nil { | ||
glog.Warningf("Transport failed http2 configuration: %v", err) | ||
} | ||
} | ||
return t | ||
} | ||
|
||
type RoundTripperWrapper interface { | ||
http.RoundTripper | ||
WrappedRoundTripper() http.RoundTripper | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
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.
So, this is the client that master will use to contact kubelet directly? And this should only be for the SPDY uses we have?
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.
It's the only exception re: @ncdc's comment above.