-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
HTTP2 and gRPC support #2539
HTTP2 and gRPC support #2539
Conversation
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.
@tanzeeb: 1 warning.
In response to this:
This PR adds support for HTTP/2 and gRPC services.
Fixes #813
Fixes #706
Fixes #707Release Note
* Support gRPC and HTTP/2 requests
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.
I think we definitely want an e2e test for this. |
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.
Thanks a lot @tanzeeb for having separately reviewable commits with meaningful commit messages. That helped a lot while stepping through this change! 🙏
The change overall looks good to me, I left a few comments throughout but nothing major at all. Great job!
/test pull-knative-serving-upgrade-tests |
/hold Thanks for reviewing @mattmoor @markusthoemmes Will fix the broken tests and add some e2e tests. |
1398d27
to
442563d
Compare
Update: TL;DR: This PR breaks for all applications that only support HTTP 1.1. Turns out I did a really bad job of 1) testing this feature, and 2) bisecting the test failure (sorry Background: Istio uses the Kubernetes Service port name of the upstream service (in our case, the Revision) to determine the request protocol. Changing the Kubernetes Service port name from // ServicePortName = "http"
ServicePortName = "http2" This will convert all requests, including HTTP 1.1 requests, into HTTP 2. This works very well for apps that support HTTP 2, but breaks all other apps. If we keep the port name as The full compatibility matrix looks like this: Port name:
Port name
Problem In this PR, I was hoping to use Potential Solution? We have to dynamically select In a previous PR there was hesitation around specifying the protocol in the revision spec. I can't think of a way around it... Update from @evankanderson:
Edit: Corrected the charts |
Thanks for the in-depth investigation. It looks like istio/istio#6158 is not very conclusive -- istio/istio#6611 reverts the behavior, but I'm wondering whether unspecified port name should be equivalent to envoy's In particular, it's possible to have a docker container which answers HTTP1, HTTP via h2c, and gRPC via h2c -- there's no particular reason why the container would need to support HTTP1, but it might be convenient for testing (distro |
This would solve all of our problems 😃 |
Is there a feature request upstream for this? USE_BEST_PROTOCOL is best
option. :-D
…On Thu, Dec 6, 2018 at 12:44 PM Tanzeeb Khalili ***@***.***> wrote:
It would be nice to be able to request "attempt http2 but fall back to
http" in the Istio configuration, which is different than
USE_DOWNSTREAM_PROTOCOL (more of a USE_BEST_PROTOCOL).
This would solve all of our problems 😃
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2539 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHlyN4ZBphnKT4JF13Zz1O5IADBJQYDaks5u2YGcgaJpZM4YxNw5>
.
--
Evan Anderson <argent@google.com>
|
442563d
to
0c252ec
Compare
0c252ec
to
58f2b1f
Compare
17987fc
to
9641f41
Compare
Changing it to http2 for all services breaks services which only support http1. Support for http2 will require selectively setting the port name to http2 only for services that explicitly support it.
… the revision protocol
d7ab918
to
1811bc0
Compare
1811bc0
to
1700fbc
Compare
The following is the coverage report on pkg/.
|
I'm comfortable with a quick followup e2e test, but note that until there is an e2e test for this functionality, it's likely to backslide and be broken by accident. |
Hi folks, Thanks for the feedback so far. I'm happy to tackle the e2e tests next, but in the meantime, here's a manual test plan: Test PlanPre-requisites
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: sia
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
container:
image: github.com/evankanderson/sia
ports:
- name: h2c # set this to `http1` to test http1
containerPort: 8080
Test HTTP 1.1
Test HTTP 2.0
Test Unary gRPC
Test Streaming gRPC
|
Understood. It's happened a few times while I was working on the PR, so e2e tests are definitely a top priority. I'd still like to get this PR in before that, so that folks have a chance to play with the functionality. There's been a lot of theoretical discussion on how this will impact other areas, such as autoscaling (eg. #2916), and it'd be helpful for those discussions to be informed by an actual implementation. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: evankanderson, tanzeeb 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 |
/lgtm |
* Use http.DefaultTransport dialer settings in h2c.DefaultTransport * Support streaming in activator/util.Rewinder * Use custom timeout handler in queue-proxy The http.TimeoutHandler will buffer the response body in memory until either the request completes or the request times out. This works well for HTTP, but is a problem for HTTP2 and gRPC streaming requests, where responses should be written as each sub-request is processed. This commit enforces the timeout by processing the request in a separate goroutine and panicing with http.ErrAbortHandler if the timeout is reached. The http.ErrAborthandler is a canary error used by the net/http and x/net/http2 packages to gracefully end the connection without dumping the stack trace. * Use http2 instead of http as the k8s service port names Istio uses port names in k8s services to determine protocols supported by the service. This change allows kservices to support HTTP/2 and gRPC traffic. * Enforce max content length for streaming requests in activator * Don't read original reader again after rewinder is closed * Use chan struct{} instead of chan bool in queue-proxy timeoutHandler * Move LimitReadCloser from activator handler to activator util and add test coverage * Add/fix godoc comments for activator/util * Explictly set Dialer config defaults in h2c.DefaultTransport * Remove timeoutHandler from queue-proxy * Revert k8s Service port name from http2 to http Changing it to http2 for all services breaks services which only support http1. Support for http2 will require selectively setting the port name to http2 only for services that explicitly support it. * Run activator on two ports, to support activating both http1 and h2c targets * Add RevisionProtocolType to API * Dynamically select 'http' or 'http2' for k8s service port name * Dynamically route to the http1 or h2c activator service port based on the revision protocol * Add test coverage for activator.ServicePort * Print errors in EnforceLengthHandler tests
This change makes numerous cleanups to the runtime contract in an attempt to improve the readability of the document and make the document more useful for the intended auidence. * Moves developer facing statements to a new `runtime-user-guide`. Focuses `runtime-contract` on operator/platform-provider. * Add links to Conformance tests that test Runtime Contract statements. * Corrects, updates, or removes statements to more accurately represent today's Knative runtime. * Updates to informative or removes most untestable statements * Copies in important OCI runtime requirements we previously referenced * Removes reference to OCI specification that didn't bring new requirements. Ref: knative#2539, knative#2973, knative#4014, knative#4027
This PR adds support for HTTP/2 and gRPC services:
h2c
,http2
and forhttp1
,http
. The default ishttp
.ClusterIngress
will route to the appropriate activator port based on the revision's protocol.Manual Test Plan
Fixes #813
Fixes #706
Fixes #707
Release Note
Edit Added implementation details.