Skip to content
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

filter: add network filters to the upstreams #7503

Merged
merged 34 commits into from
Jul 28, 2019

Conversation

kyessenov
Copy link
Contributor

Description:
Resurrection of PR #6173.
Introduces network filters bound to the upstream clusters.

Risk Level: low
Testing: unit tests
Docs Changes: see #6173
Release Notes: add upstream network filters

alanconway and others added 5 commits March 5, 2019 10:41
Allow network filters to be installed via cluster configuration,
uses the same configuration syntax as listener filters.

Added the following:
- Cluster filter config: api/envoy/api/v2/cluster/filter.proto
- Test to verify filters are applied: test/common/upstream/cluster_manager_impl_test.cc
- Create filter factory and apply to new upstream connnections
- Implement Server::Configuration::FactoryContext using contexts from TransportSocketFactoryContext

NEEDS MINOR WORK: Some FactoryContext functions throw NOT_IMPLEMENTED, because
some context objects are not obviously available to the upstream code.  Needs
attention from someone better versed in the architecture, see TODO(aconway)

This does not prevent use of the feature, most contexts are available.

This feature is used by project: https://github.com/alanconway/envoy-amqp.

Signed-off-by: Alan Conway <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
kyessenov added 2 commits July 9, 2019 12:16
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks for getting this going again. This is definitely the right direction, but a few high level comments to get started:

  1. We will needs docs, release notes, etc.
  2. I would like to see an integration test for this with a fake filter.

Thank you!

/wait

source/common/upstream/upstream_impl.cc Show resolved Hide resolved
@kyessenov
Copy link
Contributor Author

  • added an integration test
  • fixed docs CI failure (hopefully)

Signed-off-by: Kuat Yessenov <[email protected]>
@kyessenov kyessenov closed this Jul 16, 2019
Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks this is awesome. Some small comments.

/wait

docs/root/intro/version_history.rst Outdated Show resolved Hide resolved
include/envoy/server/filter_config.h Show resolved Hide resolved
include/envoy/server/filter_config.h Outdated Show resolved Hide resolved
source/common/upstream/upstream_impl.cc Outdated Show resolved Hide resolved
for (ssize_t i = 0; i < filters.size(); i++) {
const auto& proto_config = filters[i];
const std::string& string_name = proto_config.name();
ENVOY_LOG(debug, " upstream filter #{}:", i);
Copy link
Member

Choose a reason for hiding this comment

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

What does this debug output look like? It's printed for every cluster so just want to make sure it's useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is a sample:

[2019-07-25 22:02:21.833][26][info][config] [source/server/configuration_impl.cc:68] loading 1 cluster(s)
[2019-07-25 22:02:21.833][27][debug][grpc] [source/common/grpc/google_async_client_impl.cc:43] completionThread running
[2019-07-25 22:02:21.839][26][debug][upstream] [source/common/upstream/upstream_impl.cc:695]   upstream filter #0:
[2019-07-25 22:02:21.839][26][debug][upstream] [source/common/upstream/upstream_impl.cc:696]     name: envoy.upstream.polite
[2019-07-25 22:02:21.839][26][debug][upstream] [source/common/upstream/cluster_manager_impl.cc:838] adding TLS initial cluster cluster_0
[2019-07-25 22:02:21.840][26][debug][upstream] [source/common/upstream/upstream_impl.cc:845] initializing secondary cluster cluster_0 completed

source/common/upstream/upstream_impl.h Outdated Show resolved Hide resolved
test/common/upstream/BUILD Outdated Show resolved Hide resolved
test/common/upstream/cluster_manager_impl_test.cc Outdated Show resolved Hide resolved
test/common/upstream/cluster_manager_impl_test.cc Outdated Show resolved Hide resolved
test/integration/cluster_filter_integration_test.cc Outdated Show resolved Hide resolved
Signed-off-by: Kuat Yessenov <[email protected]>
@kyessenov
Copy link
Contributor Author

Thanks for the detailed review! Updated the PR to take the feedback into account.

Signed-off-by: Kuat Yessenov <[email protected]>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice, great work. Just 1 small test request.

/wait

source/common/upstream/upstream_impl.h Outdated Show resolved Hide resolved
test/integration/cluster_filter_integration_test.cc Outdated Show resolved Hide resolved
Signed-off-by: Kuat Yessenov <[email protected]>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Looks great with one tiny nit. Thanks!

/wait

@@ -44,6 +46,7 @@ class PoliteFilter : public Network::Filter, Logger::Loggable<Logger::Id::filter
}

private:
std::string greeting;
Copy link
Member

Choose a reason for hiding this comment

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

nit: const std::string greeting_;

Copy link
Member

Choose a reason for hiding this comment

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

Sorry you are missing the trailing underscore.

/wait

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duh, thanks.

Signed-off-by: Kuat Yessenov <[email protected]>
Signed-off-by: Kuat Yessenov <[email protected]>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit 0f892c2 into envoyproxy:master Jul 28, 2019
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.

6 participants