Skip to content

Conversation

zuercher
Copy link
Member

@zuercher zuercher commented Aug 9, 2018

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

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>
@zuercher
Copy link
Member Author

zuercher commented Aug 9, 2018

(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>
@zuercher
Copy link
Member Author

zuercher commented Aug 9, 2018

Ok. I think it's correct now.

Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
brian-pane
brian-pane previously approved these changes Aug 10, 2018
Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
Copy link
Member

@htuch htuch left a 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.

template <class Factory>
static ProtobufTypes::MessagePtr
translateToFactoryProtocolOptionsConfig(const Protobuf::Message& source, Factory& factory) {
ProtobufTypes::MessagePtr config = factory.createEmptyProtocolOptionsProto();
Copy link
Member

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?

Copy link
Member Author

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.

* created on behalf of this cluster.
*/
virtual ProtocolOptionsConfigConstSharedPtr
extensionProtocolOptions(const std::string& name) const PURE;
Copy link
Member

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) {
Copy link
Member

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) {
Copy link
Member

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>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coolio.

@zuercher zuercher merged commit 3e15c94 into envoyproxy:master Aug 11, 2018
@zuercher zuercher deleted the stephan/extension-protocol-config branch August 11, 2018 00:19
htuch pushed a commit that referenced this pull request Aug 20, 2018
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants