I am configuring envoy to route to multiple grpc services. I have defined a listener as follows and defined two routes
{
"bind_to_port": true,
"filters": [
{
"type": "read",
"name": "http_connection_manager",
"config": {
"codec_type": "auto",
"generate_request_id": true,
"stat_prefix": "grpc",
"route_config": {
"virtual_hosts": [
{
"name": "backend",
"domains": ["*"],
"routes": [
{
"timeout_ms": 0,
"prefix": "/grpc.sample.GrpcSampleService/",
"cluster": "service2"
},
{
"timeout_ms": 0,
"prefix": "/time.TimeService/",
"cluster": "service3"
}
]
}
]
}
and correspondingly, I have defined the Clusters as follows
"clusters": [
{
"name": "service1",
"connect_timeout_ms": 5000,
"type": "strict_dns",
"lb_type": "round_robin",
"hosts": [
{
"url": "tcp://localhost:8080"
}
]
},
{
"name": "service2",
"connect_timeout_ms": 5000,
"type": "sds",
"features": "http2",
"lb_type": "round_robin",
"service_name": "samplegrpc"
},
{
"name": "service3",
"connect_timeout_ms": 5000,
"type": "sds",
"features": "http2",
"lb_type": "round_robin",
"service_name": "time"
}
If I understand correctly, if I want to route to any grpc service, I need to repeat the "route" and "cluster" for each of them. Is that the recommended approach or is there a more simplified configuration than this?
Thanks,
Rama