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

upstream: the cluster provoded load balancing policy could be configured as extension #27512

Merged
merged 3 commits into from
May 24, 2023

Conversation

wbpcode
Copy link
Member

@wbpcode wbpcode commented May 19, 2023

Commit Message: upstream: the cluster provoded load balancing policy could be configured as extension
Additional Description:

Part of #20634.

Risk Level: low.
Testing: unit/integration.
Docs Changes: n/a.
Release Notes: added.
Platform Specific Features: n/a.

@repokitteh-read-only
Copy link

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

🐱

Caused by: #27512 was opened by wbpcode.

see: more, trace.

@wbpcode
Copy link
Member Author

wbpcode commented May 19, 2023

After this PR, only the subset couldnot be configured as extension.

@markdroth
Copy link
Contributor

/lgtm api

Copy link
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!
Overall LGTM. Left a few minor comments.

@@ -835,24 +835,35 @@ ClusterManagerImpl::loadCluster(const envoy::config::cluster::v3::Cluster& clust
auto& lb = new_cluster_pair_or_error->second;
Cluster& cluster_reference = *new_cluster;

const auto cluster_info = cluster_reference.info();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: const auto&. I assume that keeping a reference to the shared pointer is sufficient here.

Copy link
Member Author

@wbpcode wbpcode May 20, 2023

Choose a reason for hiding this comment

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

Yeah, you are complete right. Ref is enough here. But the info() will return a copy of the shared pointer rather than a ref.

So, it make no sense to use const auto& here, because we always create a copy of shared pointer. In the previous implementation, these code obviously create lots of unnecessary copies of shared pointer (by calling info() repeatedly), we reduced the copy to just once.


By the way, I think lots of interface design could be improved. For example, in the scenario to return a shared pointer member, lots of interface will return shared_ptr<T> directly, but not all callers alyways need the ownership. using const shared_ptr<T>& would be better. If we have some free time, I think we can re-evaluate these interfaces and create a clear specifications to guide these code.

@wbpcode
Copy link
Member Author

wbpcode commented May 23, 2023

friendly ping @adisuissa

Copy link
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.

LGTM, thanks!
Left a minor suggestion.

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only
Copy link

@envoyproxy/senior-maintainers assignee is @zuercher

🐱

Caused by: a #27512 (review) was submitted by @adisuissa.

see: more, trace.

@alyssawilk alyssawilk removed their assignment May 23, 2023
Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks!

@wbpcode wbpcode merged commit af9b04e into envoyproxy:main May 24, 2023
reskin89 pushed a commit to reskin89/envoy that referenced this pull request Jul 11, 2023
…red as extension (envoyproxy#27512)

* upstream: the cluster provoded load balancing policy could be configured as extension

Signed-off-by: wbpcode <[email protected]>

* address comments

Signed-off-by: wbpcode <[email protected]>

---------

Signed-off-by: wbpcode <[email protected]>
Signed-off-by: Ryan Eskin <[email protected]>
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