Skip to content

Use on-demand cluster discovery in on-demand extension#20065

Merged
htuch merged 59 commits intoenvoyproxy:mainfrom
kinvolk:krnowak/odcds
May 3, 2022
Merged

Use on-demand cluster discovery in on-demand extension#20065
htuch merged 59 commits intoenvoyproxy:mainfrom
kinvolk:krnowak/odcds

Conversation

@krnowak
Copy link
Copy Markdown
Contributor

@krnowak krnowak commented Feb 21, 2022

Commit Message:
This adds an odcds_config field to the extension's config, and also allows the extension to be configured per-route. As it stands, it currently works only with routes using cluster-header config.

Additional Description:
Risk Level:
Medium, extending one extension in an opt-in way.

Testing:
Added unit tests and integration tests.

Docs Changes:
Not sure.

Release Notes:
Extended on-demand extension with on-demand cluster discovery functionality.

Platform Specific Features:
None.

[Optional Runtime guard:]
Fixes #2500
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

CC: @jamesmulcahy

krnowak and others added 4 commits February 21, 2022 17:24
Signed-off-by: Krzesimir Nowak <krzesimir@kinvolk.io>
Signed-off-by: Krzesimir Nowak <krzesimir@kinvolk.io>
Signed-off-by: Krzesimir Nowak <krzesimir@kinvolk.io>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
@krnowak krnowak requested a review from htuch as a code owner February 21, 2022 16:34
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @lizan
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #20065 was opened by krnowak.

see: more, trace.

wanlill and others added 2 commits February 25, 2022 08:05
Copy link
Copy Markdown
Contributor

@adisuissa adisuissa 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 working on this, very exciting!
Took a first pass on the code, and left a few comments.

Comment on lines +26 to +27
// service. If not specified, the on-demand cluster discovery will
// be disabled. When it's specified, the filter will pause a request
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.

Do you think that this field should be required?
IMO if a config update contains the OnDemand extension, then it is meant to be used (and enabled).
Unless if there are scenarios where a dummy placeholder is wanted.

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 think that before the on-demand plugin was only talking to RDS if there wasn't any matching route. Not sure if we want to break this by requiring the odcds_config to be defined.

Comment on lines +41 to +42
// service. If not specified, the on-demand cluster discovery will
// be disabled. When it's specified, the filter will pause a request
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.

Same as above

Upstream::OdCdsApiHandlePtr createOdCdsApi(const ProtoConfig& proto_config,
Upstream::ClusterManager& cm,
ProtobufMessage::ValidationVisitor& validation_visitor) {
if (!proto_config.has_odcds_config() && proto_config.resources_locator().empty()) {
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.

IIRC the config-source is required no matter if resources-locator is set or not.
@htuch to correct me if I'm wrong.

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.

Sorry, my confusion here. I was reading this as resource-name instead of locator.

filter_iteration_state_ = Http::FilterHeadersStatus::StopIteration;
auto callback = std::make_unique<Upstream::ClusterDiscoveryCallback>(
[this](Upstream::ClusterDiscoveryStatus cluster_status) {
onClusterDiscoveryCompletion(cluster_status);
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.

Could there be a case where the filter is destroyed before the callback is invoked?
What I'm not certain about is whether we'll get an invocation of onClusterDiscoveryCompletion on a destroyed filter.

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.

If the filter is destroyed, then cluster_discovery_handle_ is going to be destroyed too, which will unregister and destroy the callback.

@rojkov
Copy link
Copy Markdown
Member

rojkov commented Mar 1, 2022

/wait

krnowak added 2 commits March 1, 2022 15:28
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
@rojkov
Copy link
Copy Markdown
Member

rojkov commented Mar 4, 2022

/wait
on coverage

@adisuissa adisuissa self-assigned this Mar 5, 2022
@jamesmulcahy
Copy link
Copy Markdown
Contributor

@adisuissa could you please take a look when you get a moment? Thanks!

Copy link
Copy Markdown
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

Overall LGTM.
/assign @htuch

Copy link
Copy Markdown
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 remaining comments.
/wait

krnowak added 8 commits April 28, 2022 16:34
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
@krnowak
Copy link
Copy Markdown
Contributor Author

krnowak commented Apr 29, 2022

/retest

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: a #20065 (comment) was created by @krnowak.

see: more, trace.

@krnowak
Copy link
Copy Markdown
Contributor Author

krnowak commented Apr 29, 2022

CI is green, so it's ready for review.

@jamesmulcahy
Copy link
Copy Markdown
Contributor

Thanks again, @krnowak -- fantastic work, I really appreciate it.

@krnowak
Copy link
Copy Markdown
Contributor Author

krnowak commented Apr 29, 2022

@jamesmulcahy: Thank you for the kind words. :)

I updated the PR again, this time no code changes (besides another merge from the main branch), but the CI needs to run again. I found out that there are some extra docs for on_demand extension, so I tried my hand at updating them a bit. I'd be grateful for a review of the wording. Thanks!

Copy link
Copy Markdown
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 with two nits (look forward to getting this mergred)

krnowak added 5 commits May 2, 2022 16:09
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
krnowak added 3 commits May 2, 2022 18:49
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Copy link
Copy Markdown
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, thanks! Huge win for xDS APIs, thank you so much @krnowak for your contributions here and patience through the review process.

@repokitteh-read-only repokitteh-read-only bot removed the api label May 3, 2022
@htuch htuch merged commit a41b254 into envoyproxy:main May 3, 2022
@krnowak krnowak deleted the krnowak/odcds branch May 3, 2022 10:08
ravenblackx pushed a commit to ravenblackx/envoy that referenced this pull request Jun 8, 2022
)

This adds an odcds_config field to the extension's config, and also allows the extension to be configured per-route. As it stands, it currently works only with routes using cluster-header config.

Risk Level: Medium, extending one extension in an opt-in way.
Testing: Added unit tests and integration tests.
Fixes envoyproxy#2500

Signed-off-by: Krzesimir Nowak <knowak@microsoft.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.

Lazy loading (on demand) for Routes, Clusters and Endpoints

8 participants