Skip to content

listener: create internal listener#18104

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

listener: create internal listener#18104
ggreenway merged 37 commits intoenvoyproxy:mainfrom
lambdai:ilisteneronconnect

Conversation

@lambdai
Copy link
Copy Markdown
Contributor

@lambdai lambdai commented Sep 13, 2021

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:]

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@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
Copy link
Copy Markdown
Contributor Author

lambdai commented Sep 13, 2021

Talked to @yanavlasov about this PR.
/assign yanavlasov

Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

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

/wait

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@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.

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

Looks good overall

/wait

/**
* 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.

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 9, 2021

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

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

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.

@yanavlasov
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 15, 2021

/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
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 15, 2021

/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
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 15, 2021

/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.

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

/wait-any

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.

A separate question to @junr03: should we reject api listener with internal address?
https://github.com/envoyproxy/envoy/blob/main/source/server/api_listener_impl.h#L39

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 <silentdai@gmail.com>
@lambdai
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 16, 2021

/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.

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

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
Copy link
Copy Markdown
Contributor Author

lambdai commented Nov 17, 2021

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