3

I have a Protobuf file Routing.proto used in a gRPC service. I also have an Envoy simple.yaml file. I am trying to gRPC route match on method service_B_hello(1) where 1 is a camera_id value wrapped inside CopyImageRequest. How can i do this route matching in Envoy with method parameter camera_id within the request ?

Routing.proto:

syntax = "proto3";
package routing;
message CopyImageRequest {
    int32 camera_id = 1;
}
message CopyImageResponse {
    string result = 1;
}
service RoutingService {
    rpc service_A_hello(CopyImageRequest) returns (CopyImageResponse) {};
    rpc service_B_hello(CopyImageRequest) returns (CopyImageResponse) {};
    rpc service_C_hello(CopyImageRequest) returns (CopyImageResponse) {};
}

simple.yaml Envoy file:

routes:
- match:
  prefix:"/routing.RoutingService/service_B_hello"
  headers:
  - name: "method"
    exact_match: "service_B_hello"
  - name: "camera_id"
    regex_match: ^[0-3]$
  - name: content-type
    exact_match: application/grpc            
  grpc: {}
  route:
    auto_host_rewrite: true
    cluster: grpc_stateless_service

TIA,

Vijay
  • 595
  • 1
  • 13
  • 27

0 Answers0