Skip to content

listener: create internal listener - #18104

Merged
ggreenway merged 37 commits into
envoyproxy:mainfrom
lambdai:ilisteneronconnect
Nov 17, 2021
Merged

ggreenway merged 37 commits into
envoyproxy:mainfrom
lambdai:ilisteneronconnect

Conversation

@lambdai

@lambdai lambdai commented Sep 13, 2021 •

Copy link
Copy Markdown
Contributor

Commit Message:
Implements internal listener.
This PR allows creating server connection but the abilitity to connect to such a listener is located in #18105.

Additional Description:
Risk Level: LOW. Not impacting existing TCP/UDP listener.

Testing: Mostly unit test since the dispatcher is not yet ready to create pair of internal connections.

Docs Changes:
Release Notes:
Platform Specific Features:
Runtime guard: envoy.reloadable_features.internal_address to allow/reject internal listener config.

[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #18104 was opened by lambdai.

see: more, trace.

@lambdai

lambdai commented Sep 13, 2021

Copy link
Copy Markdown
Contributor Author

Talked to @yanavlasov about this PR.
/assign yanavlasov

@yanavlasov yanavlasov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/wait

Comment thread source/common/upstream/upstream_impl.cc Resolved
Comment thread test/server/BUILD Resolved
Comment thread test/server/BUILD Resolved
Comment thread test/server/connection_handler_test.cc Resolved
Signed-off-by: Yuchen Dai <[email protected]>
Signed-off-by: Yuchen Dai <[email protected]>
@lambdai lambdai changed the title [WIP] listener: create internal listener listener: create internal listener Oct 6, 2021
@lambdai
lambdai marked this pull request as ready for review October 6, 2021 21:44
@lambdai
lambdai requested a review from alyssawilk as a code owner October 6, 2021 21:44
@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @ggreenway

🐱

Caused by: a #18104 (comment) was created by @rojkov.

see: more, trace.

@ggreenway ggreenway left a comment

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.

Looks good overall

/wait

Comment thread envoy/network/listener.h Resolved
Comment thread envoy/network/listener.h Resolved
Comment thread envoy/network/listener.h
/**
* Configuration for an internal listener.
*/
class InternalListenerConfig {

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.

It looks like this isn't used yet for anything. Delete until it's needed?

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.

This is used by the ConnectionHandler to determine if the listener type is Internal.
I feel this is cleaner than find the listen address and query the address type then dispatch by the address type.

In fact I almost make the ConnectionHandler not relying on the address type.

Comment thread source/common/tcp_proxy/tcp_proxy.cc Resolved
Signed-off-by: Yuchen Dai <[email protected]>
@lambdai

lambdai commented Nov 9, 2021

Copy link
Copy Markdown
Contributor Author

@ggreenway I resolve most of them except introducing the empty InternalListenerConfig interface. PTAL

@ggreenway ggreenway left a comment

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.

I think you need to validate listener config to make sure all the tcp-socket specific options aren't set. Such as tcp-fast-open, socket options, keepalive, mptcp, reuse_port, etc.

Comment thread envoy/network/listener.h Resolved
Comment thread envoy/network/listener.h Resolved
@yanavlasov

Copy link
Copy Markdown
Contributor

/wait

@lambdai

lambdai commented Nov 15, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18104 (comment) was created by @lambdai.

see: more, trace.

@lambdai

lambdai commented Nov 15, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18104 (comment) was created by @lambdai.

see: more, trace.

@lambdai

lambdai commented Nov 15, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18104 (comment) was created by @lambdai.

see: more, trace.

@ggreenway ggreenway left a comment

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.

/wait-any

Comment thread source/server/listener_impl.cc Outdated
void ListenerImpl::buildInternalListener() {
if (config_.address().has_envoy_internal_address()) {
internal_listener_config_ = std::make_unique<Network::InternalListenerConfig>();
if (config_.has_connection_balance_config() || config_.enable_mptcp() ||

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.

Does anything go wrong if this is thrown after buildFilterChains has already run? I can't remember if that has any interaction with the previous config on the listener. If there's any risk, you could move this into validateConfig() to do it earlier.

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.

As long as the exception was thrown prior to ListenerImpl::initialize(), there is no risk to wrongly deem the exception as a signal of "listener is wamed up".

We don't cross the line here

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.

api listener is handled early: Api listener config doesn't instantiate ListenerImpl but HttpApiListener
I add a test in listenerimpl pretending that some how a listenerImpl is constructed with Apilistener. Though in production it will never hit :)

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.

Comment thread source/server/listener_impl.cc Outdated
if (config_.has_connection_balance_config() || config_.enable_mptcp() ||
config_.has_enable_reuse_port() || config_.has_freebind() ||
config_.has_tcp_backlog_size() || config_.has_tcp_fast_open_queue_length() ||
config_.has_transparent()) {

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_.enable_mptcp(). And maybe has_api_listener()?

For all of the BoolValue's, I think it's still valid if it is present, but set to false.

This validation is going to be a big mess. Maybe it's not worth doing. Any guidance from @envoyproxy/api-shepherds on what validation to do for mutually-incompatible options?

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.

re: it's still valid if it is present. Right, Let me fix immediately.

Regarding the high level validation, I remember we opened an issue to move the tcp only options to a dedicated tcp listener config, though there was no solid move. That would be the long term fix.
Another fact is that Udp listener doesn't validate tcp options, just ignore.

I will add the quick fix on the validation here and leave api shephereds to the final call.

Signed-off-by: Yuchen Dai <[email protected]>
@lambdai

lambdai commented Nov 16, 2021

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18104 (comment) was created by @lambdai.

see: more, trace.

@ggreenway ggreenway left a comment

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.

I think this is pretty good. It's possible that we'll want to change some of the details as you complete the other parts of this (large) feature, but this is good enough for moving on to the next steps.

@ggreenway
ggreenway merged commit 8598c3f into envoyproxy:main Nov 17, 2021
@lambdai

lambdai commented Nov 17, 2021

Copy link
Copy Markdown
Contributor Author

Thank you @ggreenway @yanavlasov

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