Service Mesh (ASM) allows you to declaratively define the configurations of ASMGlobalRateLimiter by using a CustomResourceDefinition (CRD) to achieve global throttling. This topic describes the fields for ASMGlobalRateLimiter.
spec
Field | Type | Required | Description |
workloadSelector | map<string, string> | Yes | One or more labels that specify a set of workloads on which the throttling rule takes effect. The scope of label-based search is restricted to the namespace in which the resources reside. For more information, see Workload Selector. |
isGateway | bool | No | Specifies whether the throttling rule takes effect on a gateway. Default value: false. |
rateLimitService | Yes | The configurations of the global throttling service. | |
configs | Yes | The global throttling rules. |
RateLimitServiceConfig
Field | Type | Required | Description |
host | string | Yes | The domain name of the cluster in which the global throttling service resides. |
port | int | Yes | The gRPC service port of the global throttling service. |
timeout | Duration | No | The timeout period for the mesh proxy to connect to the global throttling service. Examples: |
GlobalRateLimiterConfig
Field | Type | Required | Description |
name | string | Yes | The name of the throttling rule. |
match | Yes | The match criteria. | |
limit | Yes | The throttling threshold configurations. | |
limit_overrides | No | Specifies whether to override the configured throttling threshold. You can use this field to specify a throttling threshold individually for specific requests. You can configure multiple throttling threshold overrides. Note This field is supported only by ASM instances of V1.19.0 or later. |
RatelimitMatch
Field | Type | Required | Description |
vhost | Yes | The match criteria for the virtual host. |
GlobalServiceLimitConfig
Field | Type | Required | Description |
unit | string | Yes | The unit of the throttling time. Valid values:
|
quota | int | Yes | The total number of requests allowed per unit time. |
GlobalRateLimitOverrideConfig
Field | Type | Required | Description |
request_match | Yes | The criteria that requests must match when a throttling threshold override configuration is applied. The throttling threshold specified in the override configuration is applied only to the requests that match the criteria. | |
limit | Yes | The throttling threshold specified in the throttling threshold override configuration. |
VirtualHostMatch
Field | Type | Required | Description |
name | string | Yes | The name of the virtual host to be matched. |
port | int | No | The request port to be matched. |
route | No | The name of the route corresponding to the request port to be matched. |
RouteMatch
Field | Type | Required | Description |
name_match | string | No | The name of the route to be matched. This field specifies a single route in a virtual service. |
header_match | No | The header of the service requests to be matched. You can configure multiple headers. Note In ASM instances of V1.19.0 and later, this field is deprecated. We recommend that you use GlobalRateLimitOverrideConfig to match requests. |
RequestMatcher
Multiple fields in the RequestMatcher section can be used at the same time. If you use multiple fields at the same time, only requests that meet the criteria of each field can be matched.
Field | Type | Required | Description |
header_match | No | The header for matching requests. You can configure multiple headers. | |
remote_address | No | The source IP address for matching requests. | |
query_match | No | The query parameters for matching requests. You can configure multiple query parameters. |
RemoteAddressMatcher
Field | Type | Required | Description |
address | string | Yes | The source IP address for matching requests. |
v4_prefix_mask_len | unit32 | No | If you want to match an IPv4 address range, enter the subnet mask length of the IPv4 address in this field, and enter the IPv4 address in the address field. The address range calculated after the subnet mask is used will be matched. |
v6_prefix_mask_len | unit32 | No | If you want to match an IPv6 address range, enter the subnet mask length of the IPv6 address in this field, and enter the IPv6 address in the address field. The address range calculated after the subnet mask is used will be matched. |
HeaderMatcher
Field | Type | Required | Description | |
name | string | No | The name of the header. | |
Specify one of the fields based on the match mode | regex_match | string | No | The regular expression used to perform a header match. The header value must match the specified regular expression. |
exact_match | string | No | The value used to perform a header match. The header value must exactly match the specified value. | |
prefix_match | string | No | The prefix used to perform a header match. The header value must start with the specified characters. | |
suffix_match | string | No | The suffix used to perform a header match. The header value must end with the specified characters. | |
present_match | bool | No |
| |
invert_match | bool | No | Specifies whether to invert the match result. Default value: false.
|
QueryParameterMatcher
Field | Type | Required | Description | |
name | string | Yes | The name of the query parameter. | |
Specify one of the fields based on the match mode | exact_match | string | No | The value used to perform a query parameter match. The query parameter value must exactly match the specified value. |
prefix_match | string | No | The prefix used to perform a query parameter match. The query parameter value must start with the specified characters. | |
suffix_match | string | No | The suffix used to perform a query parameter match. The query parameter value must end with the specified characters. | |
regex_match | string | No | The regular expression used to perform a query parameter match. The query parameter value must match the specified regular expression. | |
contains_match | string | No | The content used to perform a query parameter match. The query parameter value must contain the specified content. | |
present_match | bool | No |
| |
ignore_case | bool | No | Specifies whether to ignore case sensitivity when you perform a query parameter match. |