upstream: allow custom extension protocol options#4098
upstream: allow custom extension protocol options#4098zuercher merged 5 commits intoenvoyproxy:masterfrom
Conversation
Allows extension protocols to specify custom options. *Risk Level*: low, ignored by existing protocols *Testing*: unit tests *Docs Changes*: inline *Release Notes*: n/a Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
|
(There's a bug in here that I need to fix, but the general shape of this can be reviewed.) |
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
|
Ok. I think it's correct now. |
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
htuch
left a comment
There was a problem hiding this comment.
This is a good design for protocol options handling IMHO.
| template <class Factory> | ||
| static ProtobufTypes::MessagePtr | ||
| translateToFactoryProtocolOptionsConfig(const Protobuf::Message& source, Factory& factory) { | ||
| ProtobufTypes::MessagePtr config = factory.createEmptyProtocolOptionsProto(); |
There was a problem hiding this comment.
Could you use NamedNetworkFilterConfigFactory instead of templates here for factory?
There was a problem hiding this comment.
Yes. I copied translateToFactoryRouteConfig which also doesn't need to be templated. I'll fix them both.
include/envoy/upstream/upstream.h
Outdated
| * created on behalf of this cluster. | ||
| */ | ||
| virtual ProtocolOptionsConfigConstSharedPtr | ||
| extensionProtocolOptions(const std::string& name) const PURE; |
There was a problem hiding this comment.
Should this be protected instead of public? There's no value in direct access to this from outside the class other than to dynamic_cast..
| "filter envoy.test.filter does not support protocol options"); | ||
| } | ||
|
|
||
| TEST_F(ClusterInfoImplTest, ExtensionProtocolOptionsForFilterWithOptions) { |
There was a problem hiding this comment.
Please add some simple description of what the test does above each TEST_F.
| }; | ||
|
|
||
| // Cluster metadata retrieval. | ||
| TEST_F(ClusterInfoImplTest, Metadata) { |
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
…rs (#4165) #4098 Added protocol extensions for clusters and network filters. This PR expands this to http filters as well (this can be used for example in a filter that translates http to a different protocol, like our NATS Streaming filter) Risk Level: low, ignored by existing protocols Testing: unit tests Docs Changes: inline Release Notes: n/a Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Allows extension protocols to specify custom options. This is a precursor to adding Thrift-specific protocol options to the cluster configuration, but is extensible to any future extension that implements a non-HTTP protocol.
Risk Level: low, ignored by existing protocols
Testing: unit tests
Docs Changes: inline
Release Notes: n/a
Signed-off-by: Stephan Zuercher stephan@turbinelabs.io