Skip to content

filter: add network filters to the upstreams#7503

Merged
mattklein123 merged 34 commits intoenvoyproxy:masterfrom
kyessenov:upstream-filter
Jul 28, 2019
Merged

filter: add network filters to the upstreams#7503
mattklein123 merged 34 commits intoenvoyproxy:masterfrom
kyessenov:upstream-filter

Conversation

@kyessenov
Copy link
Copy Markdown
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 <aconway@redhat.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
kyessenov added 2 commits July 9, 2019 12:16
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
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

@kyessenov
Copy link
Copy Markdown
Contributor Author

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

Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov kyessenov closed this Jul 16, 2019
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
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

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
Copy Markdown
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
Copy Markdown
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

Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov
Copy link
Copy Markdown
Contributor Author

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

Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
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

Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
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

}

private:
std::string greeting;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 <kuat@google.com>
Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
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