-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
xds: introduce generic xds clients xDS and LRS Client API signatures #8042
base: master
Are you sure you want to change the base?
xds: introduce generic xds clients xDS and LRS Client API signatures #8042
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8042 +/- ##
==========================================
+ Coverage 82.23% 82.25% +0.01%
==========================================
Files 387 390 +3
Lines 38947 38971 +24
==========================================
+ Hits 32028 32054 +26
- Misses 5601 5609 +8
+ Partials 1318 1308 -10
|
042b236
to
f8f7af5
Compare
f8f7af5
to
415b2ca
Compare
@dfawley i did the godoc review and made following changes (see the last commit)
|
// Servers specifies a list of xDS servers to connect to. This field should | ||
// be used only for old-style names without an authority. |
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.
Let's leave "old" and "style" out of the docstrings and describe what it is or what it is used for in specific terms instead.
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 have modified the documentation. One more thing i have added in both Authority and here about order of servers in the list for precedence. Let me know if thats okay. I remember there was a question recently about how the fallback servers are chosen. Should we mention the gRFC as well?
20e26f8
to
c3e96f7
Compare
} | ||
|
||
// PerCluster returns the PerClusterReporter for the given cluster and service. | ||
func (s *LoadStore) PerCluster(clusterName, serviceName string) PerClusterReporter { |
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.
Super nit. Maybe the receiver name can be ls
instead of s
. I don't know if we would have more methods on this type, but if we do, we would want to use the same receiver name on all of 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.
Done
There are a few open questions here:
|
fd7d9d4
to
07c5597
Compare
|
Yes for 1 and 2. And as discussed offline, using generics for 3 might not be worth the effort. It might be a fun side project to play with generics and to see how far you can get, but for the purpose of this effort, we are OK with having type assertion in the watcher. |
// indicates that resource deletion errors can be ignored and cached | ||
// resource data can be used. | ||
// indicates that resource deletion errors from xDS management servers can | ||
// be ignored and cached resource data can be used. | ||
// | ||
// This will be removed in the future once we implement gRFC A88 | ||
// and two new fields FailOnDataErrors and | ||
// ResourceTimerIsTransientError will be introduced. | ||
IgnoreResourceDeletion bool |
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 still bothering me.
The transport shouldn't need this, so it shouldn't be in the thing we pass to it. It's specific to the xds client. So it should really be more like:
package clients
type ServerIdentifier /* ? open to bikeshedding this name */ struct {
URI string
Extensions any
}
...
package xdsclient
type ServerConfig struct {
ServerIdentifier clients.ServerIdentifier
IgnoreResourceDeletion bool
}
If we don't do this now, then eventually we'll need to add all server configuration flags into this top-level struct for all types of clients.
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 seems wrong to me. Are you suggesting ServerIdentifier to be common struct between lrs and xds client? Because I remember @markdroth mentioning that even the flags are part of server hash. We do the same in internal client implementation.
// ClientFeatures is a list of xDS features supported by this client. | ||
// clientFeatures is a list of xDS features supported by this client. | ||
// These features are set within the xDS client, but may be overridden only | ||
// for testing purposes. | ||
clientFeatures []string |
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 also strikes me as "detail of xdsclient itself, so shouldn't be here", but I'm OK with leaving it for now...let's see how the rest of the code looks
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 these will be populated by xds client implementation.
@@ -0,0 +1,57 @@ | |||
//revive:disable:unused-parameter |
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.
:(
Let's avoid annotations for tools polluting our code wherever possible.
For this one, can you not make the unused parameters nameless or _
?
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 for this file and xdsclient because the params like locality are informational but I have removed from lrsclient.go
|
||
package lrsclient | ||
|
||
// LoadStore keep track of the loads for multiple clusters and services that |
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.
"A LoadStore keeps track of"
And how about "collects" or "aggregates" instead of "keeps track of"?
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.
aggregates seems better
} | ||
|
||
// PerCluster returns the PerClusterReporter for the given cluster and service. | ||
func (ls *LoadStore) PerCluster(clusterName, serviceName string) PerClusterReporter { |
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.
How about something like ReporterForCluster
?
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.
Changed
// TransportBuilder is used to connect to the xDS management server. | ||
TransportBuilder clients.TransportBuilder | ||
|
||
// ResourceTypes is a map from resource type URLs to resource type |
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.
Can we delete TypeURL
from ResourceType
? (I feel like this came up during design review, too, but I'm not remembering if we decided to remove it, or keep it and why.)
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.
We pass around the ResourceType object and xdsclient implementation use typeURL while sending and receiving messages. So, we have to persist in ResourceType instance or pass around everywhere. I think having in ResourceType instance is more convenient.
// implementations. Each resource type URL uniquely identifies a specific | ||
// kind of xDS resource, and the corresponding resource type implementation | ||
// provides logic for parsing, validating, and processing resources of that | ||
// type. |
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.
It would be really helpful to add an example 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.
Do you mean example of mapping like below?
listenerType = xdsclient.ResourceType{
TypeURL: "type.googleapis.com/envoy.service.discovery.v3.Resource",
TypeName: ListenerResourceTypeName,
AllResourcesRequiredInSotW: true,
Decoder: listenerDecoder{},
}
resourceTypes["url"] = ListenerResourceType
|
||
// Authority contains configuration for an xDS control plane authority. | ||
// | ||
// See: https://github.com/grpc/grpc/blob/master/doc/grpc_xds_bootstrap_format.md |
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 link doesn't seem that helpful to me -- at least, it's a big-ish doc with a bunch of other stuff in it, and doesn't link to a section about the topic.
It doesn't seem like anyone actually uses federation, because I can't find any good documentation on it, either.
This is about all I can find in Envoy's docs, too:
https://github.com/cncf/xds/blob/main/proposals/TP1-xds-transport-next.md
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 have put https://www.envoyproxy.io/docs/envoy/latest/xds/core/v3/resource_locator.proto#xds-core-v3-resourcelocator as that makes more sense as someone who is using authority map would be familiar with xdstp
// The order of the servers in this list reflects the order of preference | ||
// of the data returned by those servers. xDS client use the first | ||
// available server from the list. | ||
// | ||
// See gRFC A71 for more details on fallback behavior when the primary | ||
// xDS server is unavailable. | ||
// | ||
// gRFC A71: https://github.com/grpc/proposal/blob/master/A71-xds-fallback.md |
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.
// The order of the servers in this list reflects the order of preference | |
// of the data returned by those servers. xDS client use the first | |
// available server from the list. | |
// | |
// See gRFC A71 for more details on fallback behavior when the primary | |
// xDS server is unavailable. | |
// | |
// gRFC A71: https://github.com/grpc/proposal/blob/master/A71-xds-fallback.md | |
// See Config.Servers for more details. |
?
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
// gRFC A71: https://github.com/grpc/proposal/blob/master/A71-xds-fallback.md | ||
XDSServers []clients.ServerConfig | ||
|
||
// Extensions can be populated with arbitrary authority-specific data to be |
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.
What is this used for?
What happens when an Authority isn't used for the resource?
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 haven't been able to think of any business use case for extensions in authority but in the design discussion we had agreed on having structs for all config types. For grpc name resolver we need ClientListenerResourceNameTemplate
in authority.
6091dd8
to
a1fc72b
Compare
This is the next part of generic xds clients to be usable outside of grpc which builds on top of #8024. This change is adding the user API signatures for xDS and LRS client (without implementation) to communicate with xDS management server.
POC
Internal Design
RELEASE NOTES: None