gRPC 服務 (proto)

config.core.v3.GrpcService

[config.core.v3.GrpcService proto]

gRPC 服務組態。這由 ApiConfigSource 和篩選器組態使用。

{
  "envoy_grpc": {...},
  "google_grpc": {...},
  "timeout": {...},
  "initial_metadata": [],
  "retry_policy": {...}
}
envoy_grpc

(config.core.v3.GrpcService.EnvoyGrpc) Envoy 的內建 gRPC 用戶端。請參閱 gRPC 服務概觀 文件,以了解有關 gRPC 用戶端選擇的討論。

必須設定 envoy_grpcgoogle_grpc 中的其中一個。

google_grpc

(config.core.v3.GrpcService.GoogleGrpc) Google C++ gRPC 用戶端 請參閱 gRPC 服務概觀 文件,以了解有關 gRPC 用戶端選擇的討論。

必須設定 envoy_grpcgoogle_grpc 中的其中一個。

timeout

(Duration) gRPC 請求的逾時。這是特定請求的逾時。

initial_metadata

(重複 config.core.v3.HeaderValue) 要包含在啟動到 GrpcService 的串流中的其他中繼資料。這可用於需要注入額外的臨時授權標頭 (例如 x-foo-bar: baz-key) 的情況。如需詳細資訊,包括標頭值語法的詳細資訊,請參閱關於 自訂請求標頭 的文件。

retry_policy

(config.core.v3.RetryPolicy) 服務串流的可選預設重試原則。如果非同步串流在其串流選項中未設定重試原則,則會使用此重試原則。

config.core.v3.GrpcService.EnvoyGrpc

[config.core.v3.GrpcService.EnvoyGrpc proto]

{
  "cluster_name": ...,
  "authority": ...,
  "retry_policy": {...},
  "max_receive_message_length": {...},
  "skip_envoy_headers": ...
}
cluster_name

(字串, 必要) 上游 gRPC 叢集的名稱。SSL 憑證將在 叢集 transport_socket 中提供。

authority

(字串) grpc 請求中的 :authority 標頭。如果未設定此欄位,授權標頭值將為 cluster_name。請注意,此授權不會覆寫 SNI。SNI 由叢集的傳輸 Socket 提供。

retry_policy

(config.core.v3.RetryPolicy) 指示重新建立 gRPC 串流的重試原則。此欄位為可選。如果未提供最大間隔,則會將其設定為所提供基礎間隔的十倍。目前僅支援 xDS gRPC 串流。如果未設定,則會套用 xDS gRPC 串流預設基礎間隔:500 毫秒,最大間隔:30 秒。

max_receive_message_length

(UInt32Value) 允許接收的最大 gRPC 訊息大小。如果收到的訊息超過此限制,則會以 RESOURCE_EXHAUSTED 錯誤終止 gRPC 串流。此限制適用於串流回應中的個別訊息,而不適用於串流回應的總大小。預設為 0,表示無限制。

skip_envoy_headers

(布林值) 這提供對 Envoy 產生標頭的 gRPC 用戶端層級控制。如果為 false,則會傳送標頭,但每個串流選項都可以覆寫它。如果為 true,則會移除標頭,並且每個串流選項都無法覆寫。預設值為 false。

config.core.v3.GrpcService.GoogleGrpc

[config.core.v3.GrpcService.GoogleGrpc proto]

{
  "target_uri": ...,
  "channel_credentials": {...},
  "call_credentials": [],
  "stat_prefix": ...,
  "credentials_factory_name": ...,
  "config": {...},
  "per_stream_buffer_limit_bytes": {...},
  "channel_args": {...}
}
target_uri

(字串, 必要) 使用 Google C++ gRPC 用戶端 時的目標 URI。SSL 憑證將在 channel_credentials 中提供。

channel_credentials

(config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials)

call_credentials

(重複 config.core.v3.GrpcService.GoogleGrpc.CallCredentials) 一組可以與 通道憑證 組合的呼叫憑證。

stat_prefix

(字串, 必要) 在針對 gRPC 服務發出統計資料時要使用的人類可讀前置詞。

名稱

類型

描述

streams_total

計數器

已開啟的串流總數

streams_closed_<gRPC 狀態代碼>

計數器

以 <gRPC 狀態代碼> 關閉的串流總數

credentials_factory_name

(字串) 要使用的 Google gRPC 憑證工廠的名稱。這必須已在 Envoy 中註冊。如果這是空的,則會使用預設憑證工廠,根據其他組態參數設定通道憑證。

config

(結構) Google gRPC 程式庫的特定站台自訂的其他組態。

per_stream_buffer_limit_bytes

(UInt32Value) 每個串流在內部可以緩衝多少位元組。如果未設定,則會套用實作定義的預設值 (1MiB)。

channel_args

(config.core.v3.GrpcService.GoogleGrpc.ChannelArgs) 自訂通道參數。

config.core.v3.GrpcService.GoogleGrpc.SslCredentials

[config.core.v3.GrpcService.GoogleGrpc.SslCredentials proto]

請參閱 https://grpc.dev.org.tw/grpc/cpp/structgrpc_1_1_ssl_credentials_options.html

{
  "root_certs": {...},
  "private_key": {...},
  "cert_chain": {...}
}
root_certs

(config.core.v3.DataSource) PEM 編碼的伺服器根憑證。

private_key

(config.core.v3.DataSource) PEM 編碼的用戶端私密金鑰。

cert_chain

(config.core.v3.DataSource) PEM 編碼的用戶端憑證鏈。

config.core.v3.GrpcService.GoogleGrpc.GoogleLocalCredentials

[config.core.v3.GrpcService.GoogleGrpc.GoogleLocalCredentials proto]

本機通道憑證。目前僅支援 UDS。請參閱 https://github.com/grpc/grpc/pull/15909

config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials

[config.core.v3.GrpcService.GoogleGrpc.ChannelCredentials proto]

請參閱 https://grpc.dev.org.tw/docs/guides/auth.html#credential-types,以了解通道和呼叫憑證類型。

{
  "ssl_credentials": {...},
  "google_default": {...},
  "local_credentials": {...}
}
ssl_credentials

(config.core.v3.GrpcService.GoogleGrpc.SslCredentials)

必須設定 ssl_credentialsgoogle_defaultlocal_credentials 中的其中一個。

google_default

(Empty) https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a6beb3ac70ff94bd2ebbd89b8f21d1f61

必須設定 ssl_credentialsgoogle_defaultlocal_credentials 中的其中一個。

local_credentials

(config.core.v3.GrpcService.GoogleGrpc.GoogleLocalCredentials)

必須設定 ssl_credentialsgoogle_defaultlocal_credentials 中的其中一個。

config.core.v3.GrpcService.GoogleGrpc.CallCredentials

[config.core.v3.GrpcService.GoogleGrpc.CallCredentials proto]

{
  "access_token": ...,
  "google_compute_engine": {...},
  "google_refresh_token": ...,
  "service_account_jwt_access": {...},
  "google_iam": {...},
  "from_plugin": {...},
  "sts_service": {...}
}
access_token

(字串) 存取令牌憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#ad3a80da696ffdaea943f0f858d7a360d

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

google_compute_engine

() Google Compute Engine 憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a6beb3ac70ff94bd2ebbd89b8f21d1f61

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

google_refresh_token

(字串) Google 重新整理令牌憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a96901c997b91bc6513b08491e0dca37c

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

service_account_jwt_access

(config.core.v3.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials) 服務帳戶 JWT 存取憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a92a9f959d6102461f66ee973d8e9d3aa

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

google_iam

(config.core.v3.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials) Google IAM 憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a9fc1fc101b41e680d47028166e76f9d0

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

from_plugin

(config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin) 自訂驗證器憑證。https://grpc.dev.org.tw/grpc/cpp/namespacegrpc.html#a823c6a4b19ffc71fb33e90154ee2ad07https://grpc.dev.org.tw/docs/guides/auth.html#extending-grpc-to-support-other-authentication-mechanisms

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

sts_service

(config.core.v3.GrpcService.GoogleGrpc.CallCredentials.StsService) 實作 OAuth 2.0 令牌交換的自訂安全令牌服務。https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16 請參閱 https://github.com/grpc/grpc/pull/19587

必須設定 access_tokengoogle_compute_enginegoogle_refresh_tokenservice_account_jwt_accessgoogle_iamfrom_pluginsts_service 其中之一。

config.core.v3.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials

[config.core.v3.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials proto]

{
  "json_key": ...,
  "token_lifetime_seconds": ...
}
json_key

(字串)

token_lifetime_seconds

(uint64)

config.core.v3.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials

[config.core.v3.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials proto]

{
  "authorization_token": ...,
  "authority_selector": ...
}
authorization_token

(字串)

authority_selector

(字串)

config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin

[config.core.v3.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin proto]

{
  "name": ...,
  "typed_config": {...}
}
name

(字串)

typed_config

(Any)

提示

此擴充類別具有下列已知的擴充功能

config.core.v3.GrpcService.GoogleGrpc.CallCredentials.StsService

[config.core.v3.GrpcService.GoogleGrpc.CallCredentials.StsService proto]

安全令牌服務組態,允許 Google gRPC 從 OAuth 2.0 授權伺服器擷取安全令牌。請參閱 https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16https://github.com/grpc/grpc/pull/19587

{
  "token_exchange_service_uri": ...,
  "resource": ...,
  "audience": ...,
  "scope": ...,
  "requested_token_type": ...,
  "subject_token_path": ...,
  "subject_token_type": ...,
  "actor_token_path": ...,
  "actor_token_type": ...
}
token_exchange_service_uri

(字串) 處理令牌交換請求的令牌交換服務 URI。

resource

(字串) 客戶端打算使用所請求的安全令牌的目標服務或資源位置。

audience

(字串) 客戶端打算使用所請求的安全令牌的目標服務邏輯名稱。

scope

(字串) 在將使用令牌的服務或資源內容中,所請求安全令牌的所需範圍。

requested_token_type

(字串) 所請求的安全令牌類型。

subject_token_path

(字串必要) 主題令牌的路徑,這是一個安全令牌,代表正在代表其發出請求的當事者身分。

subject_token_type

(字串必要) 主題令牌類型。

actor_token_path

(字串) 執行者令牌的路徑,這是一個安全令牌,代表執行當事者的身分。執行當事者被授權使用所請求的安全令牌,並代表主題執行動作。

actor_token_type

(字串) 執行者令牌的類型。

config.core.v3.GrpcService.GoogleGrpc.ChannelArgs

[config.core.v3.GrpcService.GoogleGrpc.ChannelArgs proto]

通道引數。

{
  "args": {...}
}
args

(repeated map<字串, config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.Value>) 請參閱 grpc_types.h GRPC_ARG #defines,了解在此處可用的金鑰。

config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.Value

[config.core.v3.GrpcService.GoogleGrpc.ChannelArgs.Value proto]

{
  "string_value": ...,
  "int_value": ...
}
string_value

(字串) 不支援指標值,因為透過 API 傳遞時沒有任何意義。

必須設定 string_valueint_value 其中之一。

int_value

(int64) 不支援指標值,因為透過 API 傳遞時沒有任何意義。

必須設定 string_valueint_value 其中之一。