ASMGrpcJsonTranscoder CRD description

Updated at:

ASMGrpcJsonTranscoder is used for JSON/HTTP-gRPC protocol transcoding. Configure the following fields to transcode HTTP/JSON requests to gRPC.

Fields

Field

Type

Required

Description

workloadSelector

map<string, string>

Yes

Uses one or more labels to specify a particular set of Pods to which the configuration applies. The scope of the label search is limited to the configuration namespace where the resource resides. For more information, see WorkloadSelector.

isGateway

bool

No

A value of true indicates that the configuration applies to a gateway. Default value: false.

portNumber

int

Yes

The service port that corresponds to the configuration. If the configuration is associated with a gateway, this is the port defined on that gateway where protocol transcoding is required (for example, 8080).

services

string[]

Yes

Specifies the services that the configuration declares in the proto file. The format is {package name}.{service name}, for example:

services:
 - 'helloworld.Greeter'

protoDescriptorBin

string

Yes

The result of Base64-encoding the content of the generated proto descriptor file. Make sure that the value contains Base64-encoded content.

transcodeFirst

bool

No

Default value: false. If you set this field to true, the HTTP request is transcoded first and then processed by other operations. This may affect some traffic processing capabilities that depend on the request. For example, for a custom external authorization service, if the request is transcoded first, the external authorization service receives a gRPC request; otherwise, it receives an HTTP request.

convertGrpcStatus

bool

No

Default value: false. Specifies whether to convert gRPC status headers to JSON. If this field is set to true and the upstream service returns a gRPC error with no HTTP body response, the google.rpc.Status message is retrieved from the gRPC status details binary header. That message is then used as the JSON body. If no such header exists, a google.rpc.Status message is generated based on the gRPC status and gRPC message headers.

For example, if the upstream service responds with the following headers:

grpc-status: 5
grpc-status-details-bin: CAUaMwoqdHlwZS5nb29nbGVhcGlzLmNvbS9nb29nbGUucnBjLlJlcXVlc3RJbmZvEgUKA3ItMQ

The gRPC status details binary header contains a Base64-encoded protobuf message google.rpc.Status. It is converted to:

HTTP/1.1 404 Not Found
content-type: application/json
{
"code": 5,
"details": [
        {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "r-1"
        }
    ]
}

ignoredQueryParameters

[]string

No

The list of query parameters to ignore when the transcoding filter maps methods. By default, if any unknown or invalid query parameters exist, the transcoding filter does not transcode the request. After you declare the HTTP request query parameters to ignore in ignoredQueryParameters, these parameters are ignored when they appear in the request, and the request is still transcoded.

ignoreUnknownQueryParameters

bool

No

Specifies whether to ignore HTTP request query parameters that cannot be mapped to the corresponding protobuf fields. Use this option if you cannot predict the query parameters. Otherwise, use ignoredQueryParameters.

Important

When both ignoredQueryParameters and ignoreUnknownQueryParameters are configured, the content declared in ignoredQueryParameters has no effect. Proceed with caution.

References

Transcode HTTP/JSON requests to gRPC with ASMGrpcJsonTranscoder