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

Enable kubectl proxy to set tcp keepalive #63793

Merged

Conversation

hzxuzhonghu
Copy link
Member

@hzxuzhonghu hzxuzhonghu commented May 14, 2018

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:

Introduce a new flag `--keepalive` for kubectl proxy to allow setting keep-alive period for long-running request.

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 14, 2018
@k8s-ci-robot
Copy link
Contributor

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

What this PR does / why we need it:
Allows setting keepalive period for kubectl proxy.

Fixes #63727

Special notes for your reviewer:

/assign @brendanburns

Release note:

Introduce a new flag `--keepalive` for kubectl proxy to allow setting keep-alive period for long-running request.

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.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 14, 2018
@k8s-ci-robot
Copy link
Contributor

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

/assign @brendanburns

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
Copy link
Member Author

/assign @brendandburns

@@ -170,6 +172,13 @@ func makeUpgradeTransport(config *rest.Config) (proxy.UpgradeRequestRoundTripper
rt := utilnet.SetOldTransportDefaults(&http.Transport{
TLSClientConfig: tlsConfig,
})

rt.DialContext = (&net.Dialer{
Copy link
Contributor

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

Copy link
Member Author

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

@brendandburns
Copy link
Contributor

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!

@hzxuzhonghu
Copy link
Member Author

That way we don't risk breaking any clients who don't use the flag.

ok, when 0 is set, keepalive is disabled.

        // KeepAlive specifies the keep-alive period for an active
	// network connection.
	// If zero, keep-alives are not enabled. Network protocols
	// that do not support keep-alives ignore this field.
	KeepAlive time.Duration

@hzxuzhonghu
Copy link
Member Author

@brendandburns comments addressed. PTAL

@hzxuzhonghu
Copy link
Member Author

kindly ping @brendandburns

@hzxuzhonghu hzxuzhonghu force-pushed the kubectl-proxy-keepalive branch 2 times, most recently from fbcab08 to c38fb07 Compare May 22, 2018 06:55
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 22, 2018
@hzxuzhonghu
Copy link
Member Author

/assign @deads2k

@hzxuzhonghu
Copy link
Member Author

/retest

@hzxuzhonghu
Copy link
Member Author

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

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?

Copy link
Member Author

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

Copy link
Member Author

Choose a reason for hiding this comment

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

removed DualStack

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 23, 2018
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2018
@hzxuzhonghu
Copy link
Member Author

@brendanburns addressed, ptal

@hzxuzhonghu
Copy link
Member Author

/test pull-kubernetes-e2e-gce

@hzxuzhonghu
Copy link
Member Author

ping @kubernetes/sig-cli-misc for approval

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Jun 29, 2018
Copy link
Member

@mengqiy mengqiy left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 10, 2018
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 10, 2018
@hzxuzhonghu
Copy link
Member Author

thanks @mengqiy

@k8s-github-robot
Copy link

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.

@k8s-github-robot k8s-github-robot merged commit aab5173 into kubernetes:master Jul 10, 2018
@wouterh-dev
Copy link

@hzxuzhonghu Should the same be done for port-forward?

@hzxuzhonghu
Copy link
Member Author

hzxuzhonghu commented Jul 23, 2018

I think it's the same. The only difference is that portforward using SPDY transport.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. 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.

None yet

7 participants