envoyproxy / envoyproxy/go-control-plane
Multiple listeners is not working with Golang XDS Client
- Dominant language
- Go
- Stars
- 1.7k
- Forks
- 567
- Avg merge
- 15h 46m
- Merged PRs (30d)
- 11
Description
I was trying to use multiple listens with Go lang XDS client. According to the go documentation, gRPC client must be tolerant of servers that may ignore the resource name in the request. I wasn't able to make that work and while debugging, I found that the code is expecting clients to send all resources names in the request. The relevant code for that check is https://github.com/envoyproxy/go-control-plane/blob/9821e2beedf61fd8fc3b8e27589f2d5e210652c2/pkg/cache/v2/simple.go#L167
According to the Go doc, the resource name is the server name hence it is not possible to send all resources in the request.
_From Go doc -_
>The gRPC client will typically start by sending an LDS request for a Listener resource whose name matches the server name from the target URI used to create the gRPC channel (including port suffix if present).
I modified the code as below and it worked as expected. I am open to submit a PR, let me know.
```
func superset(names map[string]bool, resources map[string]types.Resource) error {
for resourceName := range resources {
if _, exists := names[resourceName]; exists {
return nil
}
}
return fmt.Error("resource is not listed)
}
```
Contributor guide
Assessment
This issue has not been assessed yet.