-
Notifications
You must be signed in to change notification settings - Fork 5.1k
upstream: allow custom extension protocol options #4098
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
upstream: allow custom extension protocol options #4098
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>
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.
This is a good design for protocol options handling IMHO.
source/common/config/utility.h
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use NamedNetworkFilterConfigFactory
instead of templates here for factory?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some simple description of what the test does above each TEST_F
.
|
||
// Cluster metadata retrieval. | ||
TEST_F(ClusterInfoImplTest, Metadata) { |
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.
Nice cleanup.
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
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.
Coolio.
…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