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 chain match: support source CIDRs and ports #7064

Merged
merged 12 commits into from
May 31, 2019
Merged

Conversation

mattklein123
Copy link
Member

This PR also fully deprecates the tcp_proxy v1 configuration.
This will be deleted following the standard deprecation cycle.
All new uses should use filter chain matching.

Fixes #4457

Risk Level: Medium
Testing: New tests
Docs Changes: Added
Release Notes: Added
Deprecation Notes: Added

This PR also fully deprecates the tcp_proxy v1 configuration.
This will be deleted following the standard deprecation cycle.
All new uses should use filter chain matching.

Fixes #4457

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@PiotrSikora @htuch PTAL

@htuch This PR contains a fix for the docs build on master. Feel free to pull it out into a different PR in the morning if you want since this might take a few iterations.

Copy link
Contributor

@lambdai lambdai left a comment

Choose a reason for hiding this comment

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

Huge win!
/lgtm

source/server/listener_manager_impl.cc Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
@dio dio mentioned this pull request May 24, 2019
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
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.

LGTM, some comments I'd be interested in hearing back on..
/wait

@@ -64,6 +64,8 @@ message Filter {
// 4. Transport protocol.
// 5. Application protocols (e.g. ALPN for TLS protocol).
// 6. Source type (e.g. any, local or external network).
// 7. Source IP address.
Copy link
Member

Choose a reason for hiding this comment

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

Can you comment on the rationale behind the ordering here? Is it arbitrary? Is there a practical reason to select source IP/port as the LSBs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I talked to @PiotrSikora about this offline. Effectively, it's arbitrary, and since we are adding new ones it seems best to add them at the end? IMO this needs to be configurable but that's out of scope for this change. @PiotrSikora any additional thoughts here?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really arbitrary. The order is trying to more and more precisely describe destination (what service are you connecting to) with source selectors added at the end for the "split horizon".

This order allows filter chains to effectively act as virtual servers with fancy selectors (transport protocols, application protocols, etc.), while still being able to configure "split horizon" on a per virtual server basis for those that need it.

If source selectors had priority, then "split horizon" would be at the top of the decision tree, requiring all virtual servers to be configured for each source.

The only thing that I'm not 100% sure about is the order between source IPs and ports... Thinking about this now, perhaps it should be reversed (source port with higher priority) to allow matching connections from port X from any IP, but I honestly cannot think of a "real" use case for source port matching anyway.

There is an open issue for making the order configurable (#3411), but in the year+ that this order has been in place, I don't recall anyone complaining that the existing order doesn't work for their use case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I don't have a strong opinion on the order of IP vs. port. Perhaps ship and iterate? I'm fine either way.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation @PiotrSikora. I wonder if we should capture this somewhere, it's useful design rationale.

source/server/listener_manager_impl.cc Show resolved Hide resolved
source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
test/server/listener_manager_impl_test.cc Show resolved Hide resolved
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@htuch htuch added the waiting label May 29, 2019
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
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.

LGTM modulo a couple of comments.
/wait

source/server/listener_manager_impl.cc Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
api/envoy/api/v2/listener/listener.proto Show resolved Hide resolved
docs/root/configuration/best_practices/best_practices.rst Outdated Show resolved Hide resolved
docs/root/configuration/configuration.rst Outdated Show resolved Hide resolved
source/server/listener_manager_impl.cc Show resolved Hide resolved
@@ -64,6 +64,8 @@ message Filter {
// 4. Transport protocol.
// 5. Application protocols (e.g. ALPN for TLS protocol).
// 6. Source type (e.g. any, local or external network).
// 7. Source IP address.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really arbitrary. The order is trying to more and more precisely describe destination (what service are you connecting to) with source selectors added at the end for the "split horizon".

This order allows filter chains to effectively act as virtual servers with fancy selectors (transport protocols, application protocols, etc.), while still being able to configure "split horizon" on a per virtual server basis for those that need it.

If source selectors had priority, then "split horizon" would be at the top of the decision tree, requiring all virtual servers to be configured for each source.

The only thing that I'm not 100% sure about is the order between source IPs and ports... Thinking about this now, perhaps it should be reversed (source port with higher priority) to allow matching connections from port X from any IP, but I honestly cannot think of a "real" use case for source port matching anyway.

There is an open issue for making the order configurable (#3411), but in the year+ that this order has been in place, I don't recall anyone complaining that the existing order doesn't work for their use case.

source/server/listener_manager_impl.h Show resolved Hide resolved
test/server/listener_manager_impl_test.cc Outdated Show resolved Hide resolved
test/server/listener_manager_impl_test.cc Outdated Show resolved Hide resolved
test/server/listener_manager_impl_test.cc Outdated Show resolved Hide resolved
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@PiotrSikora thanks for the review. Updated.

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.

Rad, LGTM!

@mattklein123 mattklein123 merged commit 866d043 into master May 31, 2019
@mattklein123 mattklein123 deleted the source_ip_match branch May 31, 2019 21:20
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.

filterChainMatch: add support for source IPs and ports
5 participants