-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Enable kubectl proxy to set tcp keepalive #63793
Enable kubectl proxy to set tcp keepalive #63793
Conversation
@hzxuzhonghu: GitHub didn't allow me to assign the following users: brendanburns. Note that only kubernetes members and repo collaborators can be assigned. 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. |
@hzxuzhonghu: GitHub didn't allow me to assign the following users: brendanburns. Note that only kubernetes members and repo collaborators can be assigned. 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. |
/assign @brendandburns |
pkg/kubectl/proxy/proxy_server.go
Outdated
@@ -170,6 +172,13 @@ func makeUpgradeTransport(config *rest.Config) (proxy.UpgradeRequestRoundTripper | |||
rt := utilnet.SetOldTransportDefaults(&http.Transport{ | |||
TLSClientConfig: tlsConfig, | |||
}) | |||
|
|||
rt.DialContext = (&net.Dialer{ |
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.
hrm, I don't think this is what you want. Instead, I think that you want:
rt.Dial.Keepalive = keepalive
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.
@brendandburns Dial is deprecated, and DialContext id recommended. #60012 is making use of DialContext
Thanks for the PR, I'd prefer if this was default off, so why don't we set the keep-alive flag to -1 by default and add a condition: if keepalive >= 0 {
rt.Dial.Keepalive = keepalive
} That way we don't risk breaking any clients who don't use the flag. Thanks! |
ok, when 0 is set, keepalive is disabled.
|
245a3c7
to
1a13399
Compare
@brendandburns comments addressed. PTAL |
kindly ping @brendandburns |
fbcab08
to
c38fb07
Compare
/assign @deads2k |
/retest |
ping @brendandburns @deads2k |
@@ -169,7 +169,13 @@ func makeUpgradeTransport(config *rest.Config) (proxy.UpgradeRequestRoundTripper | |||
} | |||
rt := utilnet.SetOldTransportDefaults(&http.Transport{ | |||
TLSClientConfig: tlsConfig, | |||
DialContext: (&net.Dialer{ | |||
Timeout: 30 * time.Second, |
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.
why are we setting Timeout
and DualStack
here? shouldn't we just use the defaults?
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.
the default dial has no timeout, which can block for minutes.
I noticed http.DefaultTransport set Timeout
and DualStack
Maybe can remove DualStack
, I am not sure.
// DualStack enables RFC 6555-compliant "Happy Eyeballs"
// dialing when the network is "tcp" and the host in the
// address parameter resolves to both IPv4 and IPv6 addresses.
// This allows a client to tolerate networks where one address
// family is silently broken.
DualStack bool
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.
removed DualStack
c38fb07
to
204d994
Compare
@brendanburns addressed, ptal |
/test pull-kubernetes-e2e-gce |
ping @kubernetes/sig-cli-misc for approval |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu, mengqiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
thanks @mengqiy |
Automatic merge from submit-queue (batch tested with PRs 63793, 65989). If you want to cherry-pick this change to another branch, please follow the instructions here. |
@hzxuzhonghu Should the same be done for port-forward? |
I think it's the same. The only difference is that portforward using SPDY transport. |
What this PR does / why we need it:
Allows setting keepalive period for kubectl proxy.
Fixes #63727
Special notes for your reviewer:
/assign @brendandburns
Release note: