From a4b80d6c4348089565089122573d7de428a8dbba Mon Sep 17 00:00:00 2001 From: jrajahalme Date: Wed, 10 Jan 2018 11:23:00 -0800 Subject: [PATCH] cds: Add "auto_http2" option. (#399) Currently clusters can not open both HTTP1.1 and HTTP2 upstream connections at the same time. When the new cluster option "auto_http2" is set to "true", the cluster must open an HTTP2 upstream connection if the downstream connection is HTTP2, and an HTTP1.1 upstream connection if the downstream connection is HTTP1.1. This option is to have no effect if there is no corresponding downstream connection. This functionality removes the need to operate multiple clusters and routing rules for them when the backends accept both HTTP1.1 and HTTP2 connections, and when the choice of the HTTP protocol is significant, as with gRPC. Signed-off-by: Jarno Rajahalme --- api/cds.proto | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/api/cds.proto b/api/cds.proto index ed530b04..f795cb32 100644 --- a/api/cds.proto +++ b/api/cds.proto @@ -162,24 +162,20 @@ message Cluster { // verification. UpstreamTlsContext tls_context = 11; - oneof protocol_options { - // [#not-implemented-hide:] - TcpProtocolOptions tcp_protocol_options = 12; - - // Additional options when handling HTTP1 requests. - Http1ProtocolOptions http_protocol_options = 13; - - // Even if default HTTP2 protocol options are desired, this field must be - // set so that Envoy will assume that the upstream supports HTTP/2 when - // making new HTTP connection pool connections. Currently, Envoy only - // supports prior knowledge for upstream connections. Even if TLS is used - // with ALPN, `http2_protocol_options` must be specified. As an aside this allows HTTP/2 - // connections to happen over plain text. - Http2ProtocolOptions http2_protocol_options = 14; - - // [#not-implemented-hide:] - GrpcProtocolOptions grpc_protocol_options = 15; - } + reserved 12; + + // Additional options when handling HTTP1 requests. + Http1ProtocolOptions http_protocol_options = 13; + + // Even if default HTTP2 protocol options are desired, this field must be + // set so that Envoy will assume that the upstream supports HTTP/2 when + // making new HTTP connection pool connections. Currently, Envoy only + // supports prior knowledge for upstream connections. Even if TLS is used + // with ALPN, `http2_protocol_options` must be specified. As an aside this allows HTTP/2 + // connections to happen over plain text. + Http2ProtocolOptions http2_protocol_options = 14; + + reserved 15; // If the DNS refresh rate is specified and the cluster type is either // :ref:`STRICT_DNS`, @@ -418,6 +414,16 @@ message Cluster { // For instance, if the metadata is intended for the Router filter, the filter // name should be specified as *envoy.router*. Metadata metadata = 25; + + enum ClusterProtocolSelection { + // Cluster can only operate on one of the possible upstream protocols (HTTP1.1, HTTP2). + // If :ref:`http2_protocol_options ` are + // present, HTTP2 will be used, otherwise HTTP1.1 will be used. + USE_CONFIGURED_PROTOCOL = 0; + // Use HTTP1.1 or HTTP2, depending on which one is used on the downstream connection. + USE_DOWNSTREAM_PROTOCOL = 1; + } + ClusterProtocolSelection protocol_selection = 26; } // An extensible structure containing the address Envoy should bind to when