Skip to content

Latest commit

 

History

History
103 lines (94 loc) · 18.2 KB

apisix_route_v2.md

File metadata and controls

103 lines (94 loc) · 18.2 KB
title
ApisixRoute/v2 Reference

Spec

Meaning of each field in the spec of ApisixRoute are followed, the top level fields (apiVersion, kind and metadata) are same as other Kubernetes Resources.

Field Type Description
http array ApisixRoute's HTTP route rules.
http[].name string (required) The route rule name.
http[].priority integer The route priority, it's used to determine which route will be hitted when multile routes contains the same URI. Large number means higher priority.
http[].timeout object Sets the timeout for connecting to, and sending and receiving messages between the Ingress and Service. This will overwrite the timeout value configured in your ApisixUpstream.
http[].timeout.connect string Time duration in the form "72h3m0.5s"
http[].timeout.send string Time duration in the form "72h3m0.5s"
http[].timeout.read string Time duration in the form "72h3m0.5s"
http[].match object Route match conditions.
http[].match.paths array A series of URI that should be matched (oneof) to use this route rule.
http[].match.hosts array A series of hosts that should be matched (oneof) to use this route rule.
http[].match.methods array A series of HTTP methods(GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, CONNECT, TRACE) that should be matched (oneof) to use this route rule.
http[].match.remoteAddrs array A series of IP address (CIDR format) that should be matched (oneof) to use this route rule.
http[].match.exprs array A series expressions that the results should be matched (oneof) to use this route rule.
http[].match.exprs[].subject object Expression subject.
http[].match.exprs[].subject.scope string Specify where to find the subject, values can be Header, Query, Cookie and Path.
http[].match.exprs[].subject.name string Specify subject name, when scope is Path, this field can be absent.
http[].match.exprs[].op string Expression operator, see Expression Operators for the detail of enumerations.
http[].match.exprs[].value string Expected expression result, it's exclusive with http[].match.exprs[].set.
http[].match.exprs[].set array Expected expression result set, only used when the operator is In or NotIn, it's exclusive with http[].match.exprs[].value.
http[].websocket boolean Whether enable websocket proxy.
http[].plugin_config_name string Using exist PluginConfig for ApisixRoute.
http[].backends object The backend services. When the number of backends more than one, weight based traffic split policy will be applied to shifting traffic between these backends.
http[].backends[].serviceName string The backend service name, note the service and ApisixRoute should be created in the same namespace. Cross namespace referencing is not allowed.
http[].backends[].servicePort integer or string The backend service port, can be the port number or the name defined in the service object.
http[].backends[].resolveGranularity string See Service Resolve Granularity for the details.
http[].backends[].weight int The backend weight, which is critical when shifting traffic between multiple backends, default is 100. Weight is ignored when there is only one backend.
http[].backends[].subset string Subset specifies a subset for the target Service. The subset should be pre-definedin ApisixUpstream about this service.
http[].plugins array A series of APISIX plugins that will be executed once this route rule is matched
http[].plugins[].name string The plugin name, see docs for learning the available plugins.
http[].plugins[].enable boolean Whether the plugin would be used
http[].plugins[].config object The configuration of the plugin that must have the same fields as in APISIX.
http[].authentication object A series of APISIX authentication plugins.
http[].authentication.enable boolean Whether the plugin would be used.
http[].authentication.type string Plugin type, one of "basicAuth" "keyAuth"
http[].authentication.keyAuth object Unique key for a Consumer.
http[].authentication.keyAuth.header string The header to get the key from.
stream array ApisixRoutes' stream route rules, which contains TCP or UDP rules.
stream[].protocol string (required) The protocol of rule. Support TCP or UDP
stream[].name string (required) The Route rule name.
stream[].match object (required) The Route match conditions.
stream[].match.ingressPort integer (required) the Ingress proxy server listening port, note since APISIX doesn't support dynamic listening, this port should be defined in apisix configuration.
stream[].backend object The backend service. Deprecated: use http[].backends instead.
stream[].backend.serviceName string The backend service name, note the service and ApisixRoute should be created in the same namespace. Cross namespace referencing is not allowed.
stream[].backend.servicePort integer or string The backend service port, can be the port number or the name defined in the service object.
stream[].backend.resolveGranularity string See Service Resolve Granularity for the details.
stream[].backend.subset string Subset specifies a subset for the target Service. The subset should be pre-definedin ApisixUpstream about this service.
stream[].plugins array A series of APISIX plugins that will be executed once this route rule is matched
stream[].plugins[].name string The plugin name, see docs for learning the available plugins.
stream[].plugins[].enable boolean Whether the plugin would be used
stream[].plugins[].config object The configuration of the plugin that must have the same fields as in APISIX.

Expression Operators

Operator Meaning
Equal The result of subject should be equal to the value
NotEqual The result of subject should not be equal to value
GreaterThan The result of subject should be a number and it must larger then value.
LessThan The result of subject should be a number and it must less than value.
In The result of subject should be inside the set.
NotIn The result of subject should not be inside the set.
RegexMatch The result of subject should be matched by the value (a PCRE regex pattern).
RegexNotMatch The result of subject should not be matched by the value (a PCRE regex pattern).
RegexMatchCaseInsensitive Similar with RegexMatch but the match process is case insensitive
RegexNotMatchCaseInsensitive Similar with RegexNotMatchCaseInsensitive but the match process is case insensitive.

Service Resolve Granularity

The service resolve granularity determines whether the Serivce ClusterIP or its endpoints should be filled in the target upstream of APISIX.

Granularity Meaning
endpoint Filled upstream nodes by Pods' IP.
service Filled upstream nodes by Service ClusterIP, in such a case, loadbalacing are implemented by kube-proxy.