LLMRoute is a customized Kubernetes CRD provided by Alibaba Cloud Service Mesh (ASM) designed to provide declarative configuration capabilities for routing rules related to Large Language Models (LLM). This CRD supports traffic matching based on conditions such as request headers and resource tags, and can flexibly route traffic to specified external LLM services or in-cluster inference pools. This topic details the fields of the LLMRoute resource.
Sample configuration
The following is a sample configuration of LLMRoute. For a complete example, see Traffic routing: Use ASM to manage LLM traffic.
apiVersion: istio.alibabacloud.com/v1beta1
kind: LLMRoute
metadata:
name: dashscope-route
spec:
host: dashscope.aliyuncs.com # Must be unique between different LLM providers
rules:
- name: vip-route
matches:
- headers:
user-type:
exact: subscriber # Routing item dedicated to subscribers
backendRefs:
- providerHost: dashscope.aliyuncs.com
- backendRefs:
- providerHost: dashscope.aliyuncs.comConfiguration items
LLMRoute
Configuration item | Type | Description |
host |
| The URL of the route destination host. |
gateways |
| The gateway rules, same as |
rules |
| The list of routing rules. |
LLMRule
LLMRule is used to define a single routing rule.
Configuration item | Type | Description |
name |
| The rule name. |
matches | The match conditions. | |
backendRefs | The list of backend references. |
LLMRequestMatch
LLMRequestMatch defines the conditions that requests must match.
Configuration item | Type | Description |
Headers |
| The request headers that requests must match. |
SourceLabels |
| The resource labels that requests must match. |
Gateways |
| The gateway rules that requests must match. |
LLMBackendRef
LLMBackendRef defines the information referenced by backend objects, including the following fields:
Configuration item | Type | Description |
ProviderHost |
| The target Host. |
Weight |
| The weight value. |
BackendRef | The backend object reference. |
ProviderHost and BackendRef cannot exist simultaneously.
BackendObjectReference
BackendObjectReference defines the reference information of the backend object, including the following fields:
Configuration item | Type | Description |
Group |
| The group to which the backend object belongs. |
Kind |
| The type of the backend object. |
Name |
| The name of the backend object. |
Namespace |
| The namespace of the backend object. |
Port |
| The port of the backend object. |
Currently, only InferencePool can be referenced.