thrift: allow translation between downstream and upstream protocols (#4136)

We use the new extension_protocol_options field on Cluster to allow clusters
to be configured with a transport and/or protocol. Downstream requests are
automatically translated to the upstream dialect and upstream responses are
translated back to the downstream's dialect.

Moves the TransportType and ProtocolType protobuf enums out of the
ThriftProxy message to allow their re-use in ThriftProtocolOptions.

*Risk Level*: low
*Testing*: integration test
*Docs Changes*: added thrift filter docs
*Release Notes*: n/a

Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>

Mirrored from https://github.com/envoyproxy/envoy @ c91625ed829a4ec4123bab8b4e6b223f67d88e4a
pull/620/head
data-plane-api(CircleCI) 7 years ago
parent 18c9c78c53
commit 7d6dff5f13
  1. 1
      docs/BUILD
  2. 3
      envoy/config/filter/network/thrift_proxy/v2alpha1/route.proto
  3. 94
      envoy/config/filter/network/thrift_proxy/v2alpha1/thrift_proxy.proto

@ -50,6 +50,7 @@ proto_library(
"//envoy/config/filter/network/rbac/v2:rbac",
"//envoy/config/filter/network/redis_proxy/v2:redis_proxy",
"//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy",
"//envoy/config/filter/network/thrift_proxy/v2alpha1:thrift_proxy",
"//envoy/config/grpc_credential/v2alpha:file_based_metadata",
"//envoy/config/health_checker/redis/v2:redis",
"//envoy/config/metrics/v2:metrics_service",

@ -6,7 +6,8 @@ option go_package = "v2";
import "validate/validate.proto";
import "gogoproto/gogo.proto";
// [#protodoc-title: Thrift route configuration]
// [#protodoc-title: Thrift Proxy Route Configuration]
// Thrift Proxy :ref:`configuration overview <config_network_filters_thrift_proxy>`.
// [#comment:next free field: 3]
message RouteConfiguration {

@ -8,53 +8,79 @@ import "envoy/config/filter/network/thrift_proxy/v2alpha1/route.proto";
import "validate/validate.proto";
import "gogoproto/gogo.proto";
// [#protodoc-title: Extensions Thrift Proxy]
// Thrift Proxy filter configuration.
// [#protodoc-title: Thrift Proxy]
// Thrift Proxy :ref:`configuration overview <config_network_filters_thrift_proxy>`.
// [#comment:next free field: 5]
message ThriftProxy {
enum TransportType {
option (gogoproto.goproto_enum_prefix) = false;
// Supplies the type of transport that the Thrift proxy should use. Defaults to
// :ref:`AUTO_TRANSPORT<envoy_api_enum_value_config.filter.network.thrift_proxy.v2alpha1.TransportType.AUTO_TRANSPORT>`.
TransportType transport = 2 [(validate.rules).enum.defined_only = true];
// For every new connection, the Thrift proxy will determine which transport to use.
AUTO_TRANSPORT = 0;
// Supplies the type of protocol that the Thrift proxy should use. Defaults to
// :ref:`AUTO_PROTOCOL<envoy_api_enum_value_config.filter.network.thrift_proxy.v2alpha1.ProtocolType.AUTO_PROTOCOL>`.
ProtocolType protocol = 3 [(validate.rules).enum.defined_only = true];
// The Thrift proxy will assume the client is using the Thrift framed transport.
FRAMED = 1;
// The human readable prefix to use when emitting statistics.
string stat_prefix = 1 [(validate.rules).string.min_bytes = 1];
// The Thrift proxy will assume the client is using the Thrift unframed transport.
UNFRAMED = 2;
// The route table for the connection manager is static and is specified in this property.
RouteConfiguration route_config = 4;
}
// The Thrift proxy will assume the client is using the Thrift header transport.
HEADER = 3;
}
// Thrift transport types supported by Envoy.
enum TransportType {
option (gogoproto.goproto_enum_prefix) = false;
// Supplies the type of transport that the Thrift proxy should use. Defaults to `AUTO_TRANSPORT`.
TransportType transport = 2 [(validate.rules).enum.defined_only = true];
// For downstream connections, the Thrift proxy will attempt to determine which transport to use.
// For upstream connections, the Thrift proxy will use same transport as the downstream
// connection.
AUTO_TRANSPORT = 0;
enum ProtocolType {
option (gogoproto.goproto_enum_prefix) = false;
// The Thrift proxy will use the Thrift framed transport.
FRAMED = 1;
// For every new connection, the Thrift proxy will determine which protocol to use.
// N.B. The older, non-strict binary protocol is not included in automatic protocol
// detection.
AUTO_PROTOCOL = 0;
// The Thrift proxy will use the Thrift unframed transport.
UNFRAMED = 2;
// The Thrift proxy will assume the client is using the Thrift binary protocol.
BINARY = 1;
// The Thrift proxy will assume the client is using the Thrift header transport.
HEADER = 3;
}
// The Thrift proxy will assume the client is using the Thrift non-strict binary protocol.
LAX_BINARY = 2;
// Thrift Protocol types supported by Envoy.
enum ProtocolType {
option (gogoproto.goproto_enum_prefix) = false;
// The Thrift proxy will assume the client is using the Thrift compact protocol.
COMPACT = 3;
}
// For downstream connections, the Thrift proxy will attempt to determine which protocol to use.
// Note that the older, non-strict (or lax) binary protocol is not included in automatic protocol
// detection. For upstream connections, the Thrift proxy will use the same protocol as the
// downstream connection.
AUTO_PROTOCOL = 0;
// Supplies the type of protocol that the Thrift proxy should use. Defaults to `AUTO_PROTOCOL`.
ProtocolType protocol = 3 [(validate.rules).enum.defined_only = true];
// The Thrift proxy will use the Thrift binary protocol.
BINARY = 1;
// The human readable prefix to use when emitting statistics.
string stat_prefix = 1 [(validate.rules).string.min_bytes = 1];
// The Thrift proxy will use Thrift non-strict binary protocol.
LAX_BINARY = 2;
// The route table for the connection manager is static and is specified in this property.
RouteConfiguration route_config = 4;
// The Thrift proxy will use the Thrift compact protocol.
COMPACT = 3;
}
// ThriftProtocolOptions specifies Thrift upstream protocol options. This object is used in
// in :ref:`extension_protocol_options<envoy_api_field_Cluster.extension_protocol_options>`, keyed
// by the name `envoy.filters.network.thrift_proxy`.
// [#comment:next free field: 3]
message ThriftProtocolOptions {
// Supplies the type of transport that the Thrift proxy should use for upstream connections.
// Selecting
// :ref:`AUTO_TRANSPORT<envoy_api_enum_value_config.filter.network.thrift_proxy.v2alpha1.TransportType.AUTO_TRANSPORT>`,
// which is the default, causes the proxy to use the same transport as the downstream connection.
TransportType transport = 1 [(validate.rules).enum.defined_only = true];
// Supplies the type of protocol that the Thrift proxy should use for upstream connections.
// Selecting
// :ref:`AUTO_PROTOCOL<envoy_api_enum_value_config.filter.network.thrift_proxy.v2alpha1.ProtocolType.AUTO_PROTOCOL>`,
// which is the default, causes the proxy to use the same protocol as the downstream connection.
ProtocolType protocol = 2 [(validate.rules).enum.defined_only = true];
}

Loading…
Cancel
Save