Skip to content

tcp filter: Allow specifying metadata matcher for upstream cluster#2708

Merged
alyssawilk merged 6 commits intoenvoyproxy:masterfrom
snowp:tcp-metadata
Mar 8, 2018
Merged

tcp filter: Allow specifying metadata matcher for upstream cluster#2708
alyssawilk merged 6 commits intoenvoyproxy:masterfrom
snowp:tcp-metadata

Conversation

@snowp
Copy link
Copy Markdown
Contributor

@snowp snowp commented Mar 3, 2018

Description:
This implements metadata_match for the tcp filter, which
will allow users to specify a metadata criteria that specifies what
endpoints should be considered selecting an upstream connection to the cluster.

Risk Level: Low
Small optional feature

Testing:
Added a unit test that verifies that TcpFilter#metadataMatchCriteria returns the criteria specified in the config.

Release Notes:
Added support for specifying a metadata matcher for upstream clusters in the tcp filter

Fixes #2696

API Changes
envoyproxy/data-plane-api#520

@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Mar 3, 2018

@zuercher here's the initial PR. I wasn't sure if straight up depending on the router from the tcp filter was the right call here, so happy to do any additional refactoring if necessary

@htuch
Copy link
Copy Markdown
Member

htuch commented Mar 5, 2018

@zuercher for review, @alyssawilk for merge.

Comment thread source/common/filter/tcp_proxy.cc Outdated
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: std::make_unique

Comment thread source/common/filter/tcp_proxy.h Outdated
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.

No need to check this pointer. Just "return cluster_metadata_match_criteria_.get();" which will return nullptr if the unique_ptr is null

Comment thread source/common/filter/tcp_proxy.h Outdated
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.

config_ can be nullptr, but not in this case, because WsHandlerImpl overrides this method. Please add a comment explaining this, or optionally just add a null-check on config_

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.

i added a null check because it feels safer (instead of relying on some invariant never changing), but curious how WsHandlerImpl comes into play here. is it because config_ is only null for WsHandlerImpl?

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.

Very reasonable to just add the null check.

WsHandlerImpl sub-classes TcpProxy, and uses it with a null config_. This is the only case the config is null. I have a TODO to fix that (require non-null config to simplify code).

ggreenway
ggreenway previously approved these changes Mar 6, 2018
zuercher
zuercher previously approved these changes Mar 6, 2018
@htuch
Copy link
Copy Markdown
Member

htuch commented Mar 6, 2018

@snowp can you resolve merge conflict? Thanks.

Snow Pettersen added 5 commits March 6, 2018 14:59
This implements the `metadata_match` config for the tcp filter, which
allows users to specify a metadata criteria that restricts which
endpoints should be considered when connecting to an upstream cluster.

Signed-off-by: Snow Pettersen <snowp@squareup.com>
Signed-off-by: Snow Pettersen <snowp@squareup.com>
Signed-off-by: Snow Pettersen <snowp@squareup.com>
Signed-off-by: Snow Pettersen <snowp@squareup.com>
Signed-off-by: Snow Pettersen <snowp@squareup.com>
@snowp snowp dismissed stale reviews from zuercher and ggreenway via 2b10627 March 6, 2018 19:59
@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Mar 6, 2018

Resolved the merge conflicts, but looks like the rebase dismissed the reviews :(

@alyssawilk
Copy link
Copy Markdown
Contributor

The github UI assumes changed code addresses comments by default. The comments are still there and should be visible if you click "show outdated" but I often just refer to the comments in my email to make sure I didn't miss any :-)

@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Mar 7, 2018

Oh okay that makes sense. I think this PR is ready to merge now, nothing changed since I got the approvals, they just dropped off when I resolved the merge conflict.

zuercher
zuercher previously approved these changes Mar 7, 2018
alyssawilk
alyssawilk previously approved these changes Mar 8, 2018
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk 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 - thanks for the addition!

@alyssawilk
Copy link
Copy Markdown
Contributor

Either of us can merge once you're resolved the merge conflict. If it helps reduce conflicts I don't think the release notes need to stay the bottom line :-)

@snowp snowp dismissed stale reviews from alyssawilk and zuercher via 7514e93 March 8, 2018 15:41
@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Mar 8, 2018

@alyssawilk This should be good to merge now!

@alyssawilk alyssawilk merged commit 5dc9304 into envoyproxy:master Mar 8, 2018
Shikugawa pushed a commit to Shikugawa/envoy that referenced this pull request Mar 28, 2020
* Re-enable RBE.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* review: use only RBE cache.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* review: Kick CI.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
jpsim added a commit that referenced this pull request Nov 29, 2022
Signed-off-by: JP Simard <jp@jpsim.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.

5 participants