I am using Istio 1.16 with envoy (v1.24.1)sidecar. I have created a filter for ext_proc (v3) which connect to a remote API and send some health information on each request.
ext_proc
^
|
client -> envoy -> upstream
The ext_proc is using GRPC and sending request header, request body etc... Also the processing mode is given below
request_header_mode: "SEND"
response_header_mode: "SEND"
request_body_mode: "BUFFERED"
response_body_mode: "BUFFERED"
request_trailer_mode: "SKIP"
response_trailer_mode: "SKIP"
With this processing mode configuration the context is not cancelling and the read is not reaching EOF. Therefore, my code which is inside the EOF is not working.
ctx := srv.Context()
for {
select {
case <-ctx.Done():
return ctx.Err()
default:
}
req, err := srv.Recv()
if err == io.EOF {
**send request to remote API**
return nil
}
if err != nil {
return status.Errorf(codes.Unknown, "cannot receive stream request: %v", err)
}
But, when i change the response_trailer_mode to SEND the flow is working fine, context get cancelled and EOF satisfies. Whereas, I do not need the response trailer, SKIP is the actual need. The reference code was taken from the below link ext_proc.
How to make this working with the trailer mode SKIP? Any suggestions?