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

Add XDS logic for cluster and endpoints #112

Merged
merged 4 commits into from
Oct 22, 2020

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented Oct 14, 2020

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.

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
@iffyio iffyio requested a review from markmandel October 14, 2020 18:45
@google-cla google-cla bot added the cla: yes label Oct 14, 2020
@iffyio
Copy link
Collaborator Author

iffyio commented Oct 14, 2020

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

Copy link
Member

@markmandel markmandel left a 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)]
Copy link
Member

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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 {
Copy link
Member

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

*/

use crate::cluster::{
Cluster as QuilkinCluster, ClusterLocalities, Endpoint, Locality, LocalityEndpoints,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!


/// 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!(
Copy link
Member

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)

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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 {
Copy link
Member

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?

Copy link
Collaborator Author

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

&mut self,
response: DiscoveryResponse,
) {
info!(
Copy link
Member

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! ?

Copy link
Collaborator Author

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) {
Copy link
Member

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

@markmandel markmandel merged commit f6abd60 into master Oct 22, 2020
@markmandel markmandel added the kind/feature New feature or request label Oct 22, 2020
@markmandel markmandel deleted the iu/xds-cluster-initial-impl branch April 30, 2021 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants