All Products
Search
Document Center

Alibaba Cloud Service Mesh:Description of ASMGlobalRateLimiter fields

Last Updated:Feb 05, 2024

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

RateLimitServiceConfig

Yes

The configurations of the global throttling service.

configs

GlobalRateLimiterConfig[]

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: seconds: 1 and nanos: 1000. nanos indicates nanoseconds.

GlobalRateLimiterConfig

Field

Type

Required

Description

name

string

Yes

The name of the throttling rule.

match

RatelimitMatch

Yes

The match criteria.

limit

GlobalServiceLimitConfig

Yes

The throttling threshold configurations.

limit_overrides

GlobalRateLimitOverrideConfig[]

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

VirtualHostMatch

Yes

The match criteria for the virtual host.

GlobalServiceLimitConfig

Field

Type

Required

Description

unit

string

Yes

The unit of the throttling time. Valid values:

  • MINUTE: minutes

  • SECOND: seconds

quota

int

Yes

The total number of requests allowed per unit time.

GlobalRateLimitOverrideConfig

Field

Type

Required

Description

request_match

RequestMatcher

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

GlobalServiceLimitConfig

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

RouteMatch

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

HeaderMatcher[]

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

Note

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

HeaderMatcher[]

No

The header for matching requests. You can configure multiple headers.

remote_address

RemoteAddressMatcher

No

The source IP address for matching requests.

query_match

QueryParameterMatcher[]

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

  • If you set this parameter to true, the header match is performed based on whether the header is in the request. The header with the specified name must exist in the request.

  • If you set this parameter to false, the header match is performed based on whether the header is absent. The header with the specified name cannot exist in the request.

invert_match

bool

No

Specifies whether to invert the match result. Default value: false.

  • If you set this parameter to true, the match result will be inverted. For example, a request that does not meet the specified match criteria is considered a matched request.

  • If you set this parameter to false, a request that meets the specified match criteria is considered a matched request.

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

  • If you set this parameter to true, the query parameter match is performed based on whether the query parameter is in the request. The query parameter with the specified name must exist in the request.

  • You cannot set this parameter to false. If you set this parameter to false, no configuration is specified and you must specify other match criteria.

ignore_case

bool

No

Specifies whether to ignore case sensitivity when you perform a query parameter match.

References

Use ASMGlobalRateLimiter to configure global throttling for ingress gateways and inbound traffic directed to services