-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add XDS logic for cluster and endpoints #112
Conversation
This adds the logic to processes responses from the XDS server and sends back acknowlegements according to the protocol. Implementation to talk to the server isn't included. Work on #10
So the ci failure is from rustdoc trying to treat documentation in the generated code as tests and failing to compile since those aren't tests (that's why those modules were removed when running doctests), haven't found a workaround so far to tell rustdoc to ignore them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things, mainly about being clear where things are going to plug into other pieces. Otherwise, LGTM!
@@ -21,7 +21,7 @@ | |||
mod udpa { | |||
pub mod core { | |||
pub mod v1 { | |||
#![cfg(not(doctest))] | |||
#![doc(hidden)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this is an attempt to ignore the doc tests? 😬 I see your pain here. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that was part of the plan, figured in any case we don't want to include them in our documentation. Unfortunately it seems that there isn't a clear workaround for this at the moment, I'm looking at instead excluding these modules and any of ours that depend on it, from doctests https://users.rust-lang.org/t/disabling-rustdoc-tests-for-module/50110/9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to exclude both the xds modules and cluster module that depends on it when running doc tests
} | ||
|
||
#[derive(Clone, Debug, Hash, Eq, PartialEq)] | ||
pub struct Locality { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually really interesting -- and I can see where this information could well be useful. 👍
src/xds/cluster.rs
Outdated
*/ | ||
|
||
use crate::cluster::{ | ||
Cluster as QuilkinCluster, ClusterLocalities, Endpoint, Locality, LocalityEndpoints, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cluster as QuilkinCluster, ClusterLocalities, Endpoint, Locality, LocalityEndpoints, | |
Cluster as ProxyCluster, ClusterLocalities, Endpoint, Locality, LocalityEndpoints, |
Just a suggestion?
Just thinking the project hasn't gone through legal approval on the name, so it may get changed 😃
Also a bit more generic. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/xds/cluster.rs
Outdated
|
||
/// Processes a CDS response and updates its cluster view if needed. | ||
pub(in crate::xds) async fn on_cluster_response(&mut self, response: DiscoveryResponse) { | ||
info!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be debug!
? or do we want to track each config change in the logs?
(Not against it, but thought I'd ask the question)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I only defaulted to info!
, debug!
makes sense, will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
last_seen_cluster_load_assignment_version: Option<(String, String)>, | ||
} | ||
|
||
impl ClusterManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I'm clear - this isn't plugging into anything yet, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its not instantiated in code at the moment
src/xds/cluster.rs
Outdated
&mut self, | ||
response: DiscoveryResponse, | ||
) { | ||
info!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - debug! vs info! ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
} | ||
|
||
/// Processes a CDS response and updates its cluster view if needed. | ||
pub(in crate::xds) async fn on_cluster_response(&mut self, response: DiscoveryResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that these on_*
methods are called via gRPC requests?
if so, I think it would be good to indicate that in the comments so that it's super clear where the invocations come from (especially as I know we're dealing with part code atm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
This adds the logic to processes responses from
the XDS server and sends back acknowlegements according to
the protocol. Implementation to talk to the server
isn't included.
Work on #10
This is a larger PR but the actual logic should be under 400LOC and a lot of that is wading through envoy's complicated structs to find the info we want. The rest is tests that includes handcrafting the same large and nested structs 😔 I can split it up even more if that makes sense instead.