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

WIP: portforward: symmetric half-open connection logic for client and kubelet #37072

Closed

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Nov 18, 2016

This PR adds support for half-open connections in both directions to the port-forwarding code in the client (used by kubectl port-foward) and the container runtimes in the kubelet.

The layers between those two ends of a port-forward use htpstreams (using SPDY right now, but soon also websockets: #33684) instead of raw TCP. This PR is purely about tunneling TCP in SPDY (or soon websockets).

TODO:

  • probably fix some unit tests
  • add e2e tests for the server closing a connection early

Fixes sttts@ed021fe#commitcomment-19876346.

This is in the context of #27680 which might be a race with closed connections somewhere. Though it seems that this very change will not fix #27680 as the former is about early client close, the later about early server close.


This change is Reviewable

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Nov 18, 2016
@ncdc
Copy link
Member

ncdc commented Nov 18, 2016

I think this LGTM. cc @liggitt

@k8s-bot gci gke e2e test this

@sttts
Copy link
Contributor Author

sttts commented Nov 18, 2016

@k8s-bot gci gke e2e test this

@sttts sttts added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Nov 18, 2016
func (pf *PortForwarder) getListener(protocol string, hostname string, port *ForwardedPort) (net.Listener, error) {
listener, err := net.Listen(protocol, fmt.Sprintf("%s:%d", hostname, port.Local))
func (pf *PortForwarder) getListener(protocol string, hostname string, port *ForwardedPort) (*net.TCPListener, error) {
addr, err := net.ResolveTCPAddr(protocol, fmt.Sprintf("%s:%d", hostname, port.Local))
Copy link
Member

Choose a reason for hiding this comment

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

net.JoinHostPort

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GCE e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GKE smoke e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 21, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins Kubemark GCE e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot kubemark e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins kops AWS e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot kops aws e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE etcd3 e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot gce etcd3 e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GKE smoke e2e failed for commit caa7851165ceaa7ff5fda85a7ec6bd9e4e7d32e1. Full PR test history.

The magic incantation to run this job again is @k8s-bot cvm gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@sttts sttts force-pushed the sttts-symmetric-portforward-client branch from caa7851 to 7abc8b0 Compare November 21, 2016 16:31
@sttts sttts changed the title portforward client: symmetric conn close logic portforward: symmetric half-open connection logic for client and kubelet Nov 21, 2016
@sttts
Copy link
Contributor Author

sttts commented Nov 21, 2016

/cc @fraenkel

select {
case <-copiesDone:
case err := <-localError: // catch the first error, potentially ignore the second
return err
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If both go routines error out, copiesDone could be closed. So we could miss the error, I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can fix that by not using defer.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other way to rewrite this is to expect at most 2 errors. If we see any non-nil error, we leave otherwise we wait until we see 2 nil errors.
This removes the extra go func and waitgroup.

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 21, 2016
@sttts sttts force-pushed the sttts-symmetric-portforward-client branch from 7abc8b0 to 65a5e2a Compare November 22, 2016 07:31
@sttts sttts force-pushed the sttts-symmetric-portforward-client branch from 65a5e2a to 5b0cccc Compare November 22, 2016 08:49
@k8s-ci-robot
Copy link
Contributor

Jenkins unit/integration failed for commit 5b0cccc53ea63cd933d916f9692da5e8f4eb43b7. Full PR test history.

The magic incantation to run this job again is @k8s-bot unit test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@sttts sttts force-pushed the sttts-symmetric-portforward-client branch from 5b0cccc to 3ac09ba Compare November 22, 2016 09:09
@k8s-ci-robot
Copy link
Contributor

Jenkins Bazel Build failed for commit 3ac09ba0ccb48374ace7bfc798490d54cdc7cc8d. Full PR test history.

The magic incantation to run this job again is @k8s-bot bazel test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCE Node e2e failed for commit 3ac09ba0ccb48374ace7bfc798490d54cdc7cc8d. Full PR test history.

The magic incantation to run this job again is @k8s-bot node e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit 3ac09ba0ccb48374ace7bfc798490d54cdc7cc8d. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@sttts sttts force-pushed the sttts-symmetric-portforward-client branch from 3ac09ba to db87e30 Compare November 22, 2016 14:11
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 22, 2016
@k8s-github-robot
Copy link

@sttts PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 24, 2016
@sttts sttts changed the title portforward: symmetric half-open connection logic for client and kubelet WIP: portforward: symmetric half-open connection logic for client and kubelet Nov 25, 2016
k8s-github-robot pushed a commit that referenced this pull request Dec 7, 2016
Automatic merge from submit-queue

e2e: mark portforward tests as flaky

As long as we don't get #27673 and #27680 under control, this PR marks them as `[Flaky]`.

There is #37072 in flight which might improve the situation, but is blocked on socat issues right now with half-open connections.

cc @kubernetes/sig-testing
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] Needs approval from an approver in each of these OWNERS Files:

We suggest the following people:
cc @ixdy @dchen1107
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
Copy link

This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review.

cc @ncdc @smarterclayton @sttts

You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
8 participants