自定义资源定义 API 参考
本文档提供了 APISIX Ingress 控制器自定义资源定义 (CRD) 的 API 资源描述。
包
apisix.apache.org/v1alpha1
包 v1alpha1 包含 apisix.apache.org v1alpha1 API 组的 API Schema 定义。
BackendTrafficPolicy
BackendTrafficPolicy 定义了应用于后端服务的流量处理策略配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v1alpha1 |
kind string | BackendTrafficPolicy |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec BackendTrafficPolicySpec | BackendTrafficPolicySpec 定义了应用于后端服务的流量处理策略,例如负载均衡策略、连接设置和故障转移行为。 |
Consumer
Consumer 定义了消费者的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v1alpha1 |
kind string | Consumer |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ConsumerSpec | ConsumerSpec 定义了消费者的配置,包括消费者名称、认证凭证和插件设置。 |
GatewayProxy
GatewayProxy 定义了用于将流量路由到服务的网关代理实例的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v1alpha1 |
kind string | GatewayProxy |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec GatewayProxySpec | GatewayProxySpec 定义了网关代理实例的配置,包括网络设置、全局插件和插件元数据。 |
HTTPRoutePolicy
HTTPRoutePolicy 定义了流量策略的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v1alpha1 |
kind string | HTTPRoutePolicy |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec HTTPRoutePolicySpec | HTTPRoutePolicySpec 定义了 HTTPRoutePolicy 的配置,包括路由优先级和请求匹配条件。 |
PluginConfig
PluginConfig 定义了插件配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v1alpha1 |
kind string | PluginConfig |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec PluginConfigSpec | PluginConfigSpec 定义了 PluginConfig 的期望状态,其中指定了插件及其配置。 |
类型
本节描述 CRD 使用的类型。
AdminKeyAuth
AdminKeyAuth 定义了管理员密钥认证配置。
| 字段 | 描述 |
|---|---|
value string | Value 显式设置管理员密钥值(不建议用于生产环境)。 |
valueFrom AdminKeyValueFrom | ValueFrom 指定管理员密钥的来源。 |
出现在:
AdminKeyValueFrom
AdminKeyValueFrom 定义了管理员密钥的来源。
| 字段 | 描述 |
|---|---|
secretKeyRef SecretKeySelector | SecretKeyRef 引用 Secret 中的一个键。 |
出现在:
AuthType
基础类型 (Base type): string
AuthType 定义了认证的类型。
出现在:
BackendPolicyTargetReferenceWithSectionName
基础类型 (Base type): LocalPolicyTargetReferenceWithSectionName
| 字段 | 描述 |
|---|---|
group Group | Group 是目标资源的 API 组。 |
kind Kind | Kind 是目标资源的种类。 |
name ObjectName | Name 是目标资源的名称。 |
sectionName SectionName | SectionName 是目标资源内某一部分的名称。如果未指定,此 targetRef 将针对整个资源。在以下资源中,SectionName 按如下方式解释: • Gateway:监听器名称 • HTTPRoute:HTTPRouteRule 名称 • Service:端口名称 如果指定了 SectionName,但在目标对象上不存在,则策略必须附加失败,并且策略实现应在策略的状态中记录 ResolvedRefs 或类似的条件。 |
出现在:
BackendTrafficPolicySpec
| 字段 | 描述 |
|---|---|
targetRefs BackendPolicyTargetReferenceWithSectionName 数组 | TargetRef 标识要应用策略的 API 对象。目前,后端(即 Service、ServiceImport 或任何特定实现的 backendRef)是唯一有效的 API 目标引用。 |
loadbalancer LoadBalancer | LoadBalancer 表示 Kubernetes Service 的负载均衡器配置。默认策略是轮询。 |
scheme string | Scheme 是与上游通信时使用的协议。默认值为 http。可选值为 http、https、grpc 或 grpcs。 |
retries integer | Retries 指定当发生超时或 502 错误等情况时,网关应重试发送请求的次数。 |
timeout Timeout | Timeout 设置到上游的读取、发送和连接超时。 |
passHost string | PassHost 配置当请求转发到上游时,主机标头应如何确定。默认值为 pass。可选值为 pass、node 或 rewrite:• pass:保留原始 Host 标头• node:使用上游节点的主机名• rewrite:通过 upstreamHost 设置为自定义主机 |
upstreamHost Hostname | UpstreamHost 指定上游请求的主机。仅在 passHost 设置为 rewrite 时使用。 |
出现在:
ConsumerSpec
| 字段 | 描述 |
|---|---|
gatewayRef GatewayRef | GatewayRef 指定网关详细信息。 |
credentials Credential 数组 | Credentials 指定消费者的凭证详细信息。 |
plugins Plugin 数组 | Plugins 定义与消费者关联的插件。 |
出现在:
ControlPlaneAuth
ControlPlaneAuth 定义了控制面的认证配置。
| 字段 | 描述 |
|---|---|
type AuthType | Type 指定认证的类型。只能是 AdminKey。 |
adminKey AdminKeyAuth | AdminKey 指定管理员密钥认证配置。 |
出现在:
ControlPlaneProvider
ControlPlaneProvider 定义了控制面提供者的配置。
| 字段 | 描述 |
|---|---|
mode string | Mode 指定控制面提供者的模式。可以是 apisix 或 apisix-standalone。 |
endpoints string 数组 | Endpoints 指定控制面端点的列表。 |
service ProviderService | |
tlsVerify boolean | TlsVerify 指定是否验证控制面的 TLS 证书。 |
auth ControlPlaneAuth | Auth 指定认证配置。 |
出现在:
Credential
| 字段 | 描述 |
|---|---|
type string | Type 指定要为其配置凭证的认证类型。可以是 jwt-auth、basic-auth、key-auth 或 hmac-auth。 |
config JSON | Config 指定认证的凭证详细信息。 |
secretRef SecretReference | SecretRef 引用包含凭证的 Secret。 |
name string | Name 是凭证的名称。 |
出现在:
GatewayProxyPlugin
GatewayProxyPlugin 包含插件配置。
| 字段 | 描述 |
|---|---|
name string | Name 是插件的名称。 |
enabled boolean | Enabled 定义插件是否启用。 |
config JSON | Config 定义插件的配置详细信息。 |
出现在:
GatewayProxyProvider
GatewayProxyProvider 定义了 GatewayProxy 的提供者配置。
| 字段 | 描述 |
|---|---|
type ProviderType | Type 指定提供者的类型。只能是 ControlPlane。 |
controlPlane ControlPlaneProvider | ControlPlane 指定控制面提供者的配置。 |
出现在:
GatewayProxySpec
GatewayProxySpec 定义了 GatewayProxy 的期望状态。
| 字段 | 描述 |
|---|---|
publishService string | PublishService 指定 LoadBalancer 类型的 Service,控制器使用其外部地址来更新 Ingress 资源的状态。 |
statusAddress string 数组 | StatusAddress 指定控制器用于填充 GatewayProxy 或 Ingress 资源状态字段以供开发者访问的外部 IP 地址。 |
provider GatewayProxyProvider | Provider 配置提供者的详细信息。 |
plugins GatewayProxyPlugin 数组 | Plugins 配置全局插件。 |
pluginMetadata 对象 (键:string, 值:JSON) | PluginMetadata 配置由同一名称的所有插件实例共享的通用配置。 |
出现在:
GatewayRef
| 字段 | 描述 |
|---|---|
name string | Name 是网关的名称。 |
kind string | Kind 是 Kubernetes 对象的类型。默认值为 Gateway。 |
group string | Group 是资源所属的 API 组。默认值为 gateway.networking.k8s.io。 |
namespace string | Namespace 是资源的命名空间。 |
出现在:
HTTPRoutePolicySpec
HTTPRoutePolicySpec 定义了 HTTPRoutePolicy 的期望状态。
| 字段 | 描述 |
|---|---|
targetRefs LocalPolicyTargetReferenceWithSectionName 数组 | TargetRef 标识要应用 HTTPRoutePolicy 的 API 对象(例如 HTTPRoute、Ingress)。 |
priority integer | Priority 设置路由的优先级。当多个路由具有相同的 URI 路径时,较高的值会在路由匹配中设置更高的优先级。 |
vars JSON 数组 | Vars 设置请求匹配条件。 |
出现在:
Hostname
基础类型 (Base type): string
出现在:
LoadBalancer
LoadBalancer 描述了负载均衡参数。
| 字段 | 描述 |
|---|---|
type string | Type 指定将流量路由到后端的负载均衡算法。默认值为 roundrobin。可选值为 roundrobin、chash、ewma 或 least_conn。 |
hashOn string | HashOn 指定用于哈希的字段类型,当 type 为 chash 时必需。默认值为 vars。可选值为 vars、header、cookie、consumer 或 vars_combinations。 |
key string | Key 与 HashOn 一起使用,当 type 为 chash 时通常必需。当 HashOn 为 header 或 cookie 时,指定标头或 cookie 的名称。当 HashOn 为 consumer 时,key 不是必需的,因为会自动使用消费者名称。当 HashOn 为 vars 或 vars_combinations 时,key 指一个或多个内置变量的组合。 |
出现在:
Plugin
| 字段 | 描述 |
|---|---|
name string | Name 是插件的名称。 |
config JSON | Config 是插件的配置详细信息。 |
出现在:
PluginConfigSpec
PluginConfigSpec 定义了 PluginConfig 的期望状态。
| 字段 | 描述 |
|---|---|
plugins Plugin 数组 | Plugins 是一个插件及其配置的数组,将被应用。 |
出现在:
ProviderService
| 字段 | 描述 |
|---|---|
name string | Name 是提供者的名称。 |
port integer | Port 是提供者的端口。 |
出现在:
ProviderType
基础类型 (Base type): string
ProviderType 定义了提供者的类型。
出现在:
SecretKeySelector
SecretKeySelector 定义了对 Secret 中特定键的引用。
| 字段 | 描述 |
|---|---|
name string | Name 是 Secret 的名称。 |
key string | Key 是要从中检索 Secret 的 Secret 中的键。 |
出现在:
SecretReference
| 字段 | 描述 |
|---|---|
name string | Name 是 Secret 的名称。 |
namespace string | Namespace 是 Secret 的命名空间。 |
出现在:
Status
| 字段 | 描述 |
|---|---|
conditions Condition 数组 |
出现在:
Timeout
| 字段 | 描述 |
|---|---|
connect Duration | 连接超时。默认值为 60s。 |
send Duration | 发送超时。默认值为 60s。 |
read Duration | 读取超时。默认值为 60s。 |
出现在:
apisix.apache.org/v2
包 v2 包含 apisix.apache.org v2 API 组的 API Schema 定义。
ApisixConsumer
ApisixConsumer 定义了消费者及其认证详细信息的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixConsumer |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixConsumerSpec | ApisixConsumerSpec 定义了消费者认证配置。 |
ApisixGlobalRule
ApisixGlobalRule 定义了全局插件的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixGlobalRule |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixGlobalRuleSpec | ApisixGlobalRuleSpec 定义了全局插件配置。 |
ApisixPluginConfig
ApisixPluginConfig 定义了一组可重用的插件配置,可供路由引用。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixPluginConfig |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixPluginConfigSpec | ApisixPluginConfigSpec 定义了插件配置的配置。 |
ApisixRoute
ApisixRoute 定义了 HTTP 和 stream 路由的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixRoute |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixRouteSpec | ApisixRouteSpec 定义了 HTTP 和 stream 路由配置。 |
ApisixTls
ApisixTls 定义了 TLS 和双向 TLS (mTLS) 的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixTls |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixTlsSpec | ApisixTlsSpec 定义了 TLS 配置。 |
ApisixUpstream
ApisixUpstream 定义了上游服务的配置。
| 字段 | 描述 |
|---|---|
apiVersion string | apisix.apache.org/v2 |
kind string | ApisixUpstream |
metadata ObjectMeta | 有关 metadata 字段的详细信息,请参阅 Kubernetes API 文档。 |
spec ApisixUpstreamSpec | ApisixUpstreamSpec 定义了上游配置。 |
类型
本节描述 CRD 使用的类型。
ActiveHealthCheck
ActiveHealthCheck 定义了主动上游健康检查配置。
| 字段 | 描述 |
|---|---|
type string | Type 是健康检查类型。可以是 http、https 或 tcp。 |
timeout Duration | Timeout 设置健康检查超时时间(秒)。 |
concurrency integer | Concurrency 设置同时检查的目标数量。 |
host string | Host 设置上游主机。 |
port integer | Port 设置上游端口。 |
httpPath string | HTTPPath 设置 HTTP 探测请求路径。 |
strictTLS boolean | StrictTLS 设置是否强制执行 TLS。 |
requestHeaders string 数组 | RequestHeaders 设置请求标头。 |
healthy ActiveHealthCheckHealthy | Healthy 配置定义上游节点为健康的条件。 |
unhealthy ActiveHealthCheckUnhealthy | Unhealthy 配置定义上游节点为不健康的条件。 |
出现在:
ActiveHealthCheckHealthy
UpstreamActiveHealthCheckHealthy 定义了用于主动确定上游节点是否健康的条件。
| 字段 | 描述 |
|---|---|
httpCodes integer 数组 | HTTPCodes 定义被视为健康的 HTTP 状态码列表。 |
successes integer | Successes 定义将目标定义为健康所需的成功探测次数。 |
interval Duration | Interval 定义检查目标的时间间隔(秒)。 |
出现在:
ActiveHealthCheckUnhealthy
UpstreamActiveHealthCheckHealthy 定义了用于主动确定上游节点是否不健康的条件。
| 字段 | 描述 |
|---|---|
httpCodes integer 数组 | HTTPCodes 定义被视为不健康的 HTTP 状态码列表。 |
httpFailures integer | HTTPFailures 定义将目标定义为不健康所需的 HTTP 失败次数。 |
tcpFailures integer | TCPFailures 定义将目标定义为不健康所需的 TCP 失败次数。 |
timeout integer | Timeout 设置将目标定义为不健康所需的超时次数。 |
interval Duration | Interval 定义检查目标的时间间隔(秒)。 |
出现在:
ApisixConsumerAuthParameter
| 字段 | 描述 |
|---|---|
basicAuth ApisixConsumerBasicAuth | BasicAuth 配置基本认证详细信息。 |
keyAuth ApisixConsumerKeyAuth | KeyAuth 配置密钥认证详细信息。 |
wolfRBAC ApisixConsumerWolfRBAC | WolfRBAC 配置 Wolf RBAC 认证详细信息。 |
jwtAuth ApisixConsumerJwtAuth | JwtAuth 配置 JWT 认证详细信息。 |
hmacAuth ApisixConsumerHMACAuth | HMACAuth 配置 HMAC 认证详细信息。 |
ldapAuth ApisixConsumerLDAPAuth | LDAPAuth 配置 LDAP 认证详细信息。 |
出现在:
ApisixConsumerBasicAuth
ApisixConsumerBasicAuth 定义了基本认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含基本认证凭证的 Kubernetes Secret。 |
value ApisixConsumerBasicAuthValue | Value 指定基本认证凭证。 |
出现在:
ApisixConsumerBasicAuthValue
ApisixConsumerBasicAuthValue 定义了基本认证的用户名和密码配置。
| 字段 | 描述 |
|---|---|
username string | Username 是基本认证用户名。 |
password string | Password 是基本认证密码。 |
出现在:
ApisixConsumerHMACAuth
ApisixConsumerHMACAuth 定义了 HMAC 认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含 HMAC 凭证的 Kubernetes Secret。 |
value ApisixConsumerHMACAuthValue | Value 指定 HMAC 认证凭证。 |
出现在:
ApisixConsumerHMACAuthValue
ApisixConsumerHMACAuthValue 定义了 HMAC 认证的配置。
| 字段 | 描述 |
|---|---|
key_id string | KeyID 是用于查找 HMAC 密钥的标识符。 |
secret_key string | SecretKey 是用于签署请求的 HMAC 密钥。 |
access_key string | AccessKey 是用于查找 HMAC 密钥的标识符。已从消费者配置中弃用 |
algorithm string | Algorithm 指定哈希算法(例如 "hmac-sha256")。已从消费者配置中弃用 |
clock_skew integer | ClockSkew 是客户端和服务器时钟之间允许的时间差(以秒为单位)。已从消费者配置中弃用 |
signed_headers string 数组 | SignedHeaders 列出必须包含在签名中的标头。已从消费者配置中弃用 |
keep_headers boolean | KeepHeaders 确定 HMAC 签名标头在验证后是否保留。已从消费者配置中弃用 |
encode_uri_params boolean | EncodeURIParams 指示在计算签名时是否对 URI 参数进行编码。已从消费者配置中弃用 |
validate_request_body boolean | ValidateRequestBody 启用请求体的 HMAC 验证。已从消费者配置中弃用 |
max_req_body integer | MaxReqBody 设置可以验证的请求体的最大大小(以字节为单位)。已从消费者配置中弃用 |
出现在:
ApisixConsumerJwtAuth
ApisixConsumerJwtAuth 定义了 JWT 认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含 JWT 认证凭证的 Kubernetes Secret。 |
value ApisixConsumerJwtAuthValue | Value 指定 JWT 认证凭证。 |
出现在:
ApisixConsumerJwtAuthValue
ApisixConsumerJwtAuthValue 定义了 JWT 认证的配置。
| 字段 | 描述 |
|---|---|
key string | Key 是 JWT 凭证的唯一标识符。 |
secret string | Secret 是用于签名 JWT 的共享密钥(用于对称算法)。 |
public_key string | PublicKey 是用于验证 JWT 签名的公钥(用于非对称算法)。 |
private_key string | PrivateKey 是用于签名 JWT 的私钥(用于非对称算法)。 |
algorithm string | Algorithm 指定签名算法。可以是 HS256、HS384、HS512、RS256、RS384、RS512、ES256、ES384、ES512、PS256、PS384、PS512 或 EdDSA。目前 APISIX 仅支持 HS256、HS512、RS256 和 ES256。API7 企业版支持所有算法。 |
exp integer | Exp 是令牌过期时间(秒)。 |
base64_secret boolean | Base64Secret 指示密钥是否经过 base64 编码。 |
lifetime_grace_period integer | LifetimeGracePeriod 是令牌过期允许的时钟偏差(秒)。 |
出现在:
ApisixConsumerKeyAuth
ApisixConsumerKeyAuth 定义了密钥认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含密钥认证凭证的 Kubernetes Secret。 |
value ApisixConsumerKeyAuthValue | Value 指定密钥认证凭证。 |
出现在:
ApisixConsumerKeyAuthValue
ApisixConsumerKeyAuthValue 定义了密钥认证的配置。
| 字段 | 描述 |
|---|---|
key string | Key 是用于密钥认证的凭证。 |
出现在:
ApisixConsumerLDAPAuth
ApisixConsumerLDAPAuth 定义了 LDAP 认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含 LDAP 凭证的 Kubernetes Secret。 |
value ApisixConsumerLDAPAuthValue | Value 指定 LDAP 认证凭证。 |
出现在:
ApisixConsumerLDAPAuthValue
ApisixConsumerLDAPAuthValue 定义了 LDAP 认证的配置。
| 字段 | 描述 |
|---|---|
user_dn string | UserDN 是 LDAP 用户的专有名称 (DN)。 |
出现在:
ApisixConsumerSpec
ApisixConsumerSpec 定义了 ApisixConsumer 的期望状态。
| 字段 | 描述 |
|---|---|
ingressClassName string | IngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理该资源。 |
authParameter ApisixConsumerAuthParameter | AuthParameter 定义此消费者的认证凭证和配置。 |
出现在:
ApisixConsumerWolfRBAC
ApisixConsumerWolfRBAC 定义了 Wolf RBAC 认证的配置。
| 字段 | 描述 |
|---|---|
secretRef LocalObjectReference | SecretRef 引用包含 Wolf RBAC 令牌的 Kubernetes Secret。 |
value ApisixConsumerWolfRBACValue | Value 指定 Wolf RBAC 令牌。 |
出现在:
ApisixConsumerWolfRBACValue
ApisixConsumerWolfRBACValue 定义了 Wolf RBAC 认证的配置。
| 字段 | 描述 |
|---|---|
server string | Server 是 Wolf RBAC 服务器的 URL。 |
appid string | Appid 是与 Wolf RBAC 服务器通信时使用的应用程序标识符。 |
header_prefix string | HeaderPrefix 是添加到请求标头以进行 RBAC 执行的前缀。 |
出现在:
ApisixGlobalRuleSpec
ApisixGlobalRuleSpec 定义了全局插件的配置。
| 字段 | 描述 |
|---|---|
ingressClassName string | IngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理该资源。 |
plugins ApisixRoutePlugin 数组 | Plugins 包含全局插件列表。 |
出现在:
ApisixMutualTlsClientConfig
ApisixMutualTlsClientConfig 描述了双向 TLS CA 和验证设置。
| 字段 | 描述 |
|---|---|
caSecret ApisixSecret | CASecret 引用包含用于客户端证书验证的 CA 证书的 Secret。 |
depth integer | Depth 指定客户端证书链的最大验证深度。 |
skip_mtls_uri_regex string 数组 | SkipMTLSUriRegex 包含用于跳过双向 TLS 验证的 URI 正则表达式模式。 |
出现在:
ApisixPluginConfigSpec
ApisixPluginConfigSpec 定义了 ApisixPluginConfigSpec 的期望状态。
| 字段 | 描述 |
|---|---|
ingressClassName string | IngressClassName 是 IngressClass 集群资源的名称。控制器使用此字段来决定是否应管理该资源。 |
plugins ApisixRoutePlugin 数组 | Plugins 包含插件列表。 |
出现在:
ApisixRouteAuthentication
ApisixRouteAuthentication 表示 ApisixRoute 中与认证相关的配置。
| 字段 | 描述 |
|---|---|
enable boolean | Enable 打开或关闭认证。 |
type string | Type 指定认证类型。 |
keyAuth ApisixRouteAuthenticationKeyAuth | KeyAuth 定义密钥认证的配置。 |
jwtAuth ApisixRouteAuthenticationJwtAuth | JwtAuth 定义 JWT 认证的配置。 |
ldapAuth ApisixRouteAuthenticationLDAPAuth | LDAPAuth 定义 LDAP 认证的配置。 |
出现在:
ApisixRouteAuthenticationJwtAuth
ApisixRouteAuthenticationJwtAuth 定义了 ApisixRouteAuthentication 中的 JWT 认证配置。
| 字段 | 描述 |
|---|---|
header string | Header 指定用于查找 JWT 令牌的 HTTP 标头名称。 |
query string | Query 指定用于查找 JWT 令牌的 URL 查询参数名称。 |
cookie string | Cookie 指定用于查找 JWT 令牌的 Cookie 名称。 |
出现在:
ApisixRouteAuthenticationKeyAuth
ApisixRouteAuthenticationKeyAuth 定义了 ApisixRouteAuthentication 中的密钥认证配置。
| 字段 | 描述 |
|---|---|
header string | Header 指定用于查找密钥认证令牌的 HTTP 标头名称。 |
出现在:
ApisixRouteAuthenticationLDAPAuth
ApisixRouteAuthenticationLDAPAuth 定义了 ApisixRouteAuthentication 中的 LDAP 认证配置。
| 字段 | 描述 |
|---|---|
base_dn string | BaseDN 是 LDAP 搜索的基础专有名称 (DN)。 |
ldap_uri string | LDAPURI 是 LDAP 服务器的 URI。 |
use_tls boolean | UseTLS 指示是否对 LDAP 连接使用 TLS。 |
uid string | UID 是 LDAP 中的用户标识属性。 |
出现在:
ApisixRouteHTTP
ApisixRouteHTTP 表示单个 HTTP 路由配置。
| 字段 | 描述 |
|---|---|
name string | Name 是唯一的规则名称,不能为空。 |
priority integer | Priority 定义当多个路由共享相同 URI 路径时的路由优先级。数值越高,路由匹配优先级越高。 |
timeout UpstreamTimeout | Timeout 指定上游超时设置。 |
match ApisixRouteHTTPMatch | Match 定义 HTTP 请求匹配条件。 |
backends ApisixRouteHTTPBackend 数组 | Backends 列出要代理请求到的潜在后端服务。如果指定了多个后端,则使用 traffic-split 插件根据后端权重分配流量。 |
upstreams ApisixRouteUpstreamReference 数组 | Upstreams 引用 ApisixUpstream CRD。 |
websocket boolean | Websocket 为此路由启用或禁用 WebSocket 支持。 |
plugin_config_name string | PluginConfigName 指定要应用的插件配置的名称。 |
plugin_config_namespace string | PluginConfigNamespace 指定插件配置的命名空间。如果未设置,默认为 ApisixRoute 的命名空间。 |
plugins ApisixRoutePlugin 数组 | Plugins 列出应用于此路由的其他插件。 |
authentication ApisixRouteAuthentication | Authentication 包含此路由的认证相关配置。 |
出现在:
ApisixRouteHTTPBackend
ApisixRouteHTTPBackend 表示一个 HTTP 后端(Kubernetes Service)。
| 字段 | 描述 |
|---|---|
serviceName string | ServiceName 是 Kubernetes Service 的名称。不支持跨命名空间引用 — 确保 ApisixRoute 和 Service 位于同一命名空间中。 |
servicePort IntOrString | ServicePort 是 Kubernetes Service 的端口。可以是端口名称或端口号。 |
resolveGranularity string | ResolveGranularity 确定后端服务的解析方式。有效值为 endpoints 和 service。设置为 endpoints 时,将使用单个 Pod IP;否则,使用 Service 的 ClusterIP 或 ExternalIP。默认值为 endpoints。 |
weight integer | Weight 指定此后端的相对流量权重。 |
subset string | Subset 指定目标 Service 的命名子集。该子集必须在相应的 ApisixUpstream 资源中预先定义。 |
出现在:
ApisixRouteHTTPMatch
ApisixRouteHTTPMatch 定义了用于匹配传入 HTTP 请求的条件。
| 字段 | 描述 |
|---|---|
paths string 数组 | Paths 是要匹配的 URI 路径模式列表。必须至少指定一个路径。支持精确匹配和前缀匹配。对于前缀匹配,在路径后附加 *,例如 /foo*。 |
methods string 数组 | Methods 指定要匹配的 HTTP 方法。 |
hosts string 数组 | Hosts 指定要匹配的 Host 标头值。支持精确匹配和通配符域名。只允许一级通配符(例如 *.example.com 有效,但 *.*.example.com 无效)。 |
remoteAddrs string 数组 | RemoteAddrs 是要匹配的源 IP 地址或 CIDR 范围列表。支持 IPv4 和 IPv6 格式。 |
exprs ApisixRouteHTTPMatchExprs | NginxVars 定义基于 Nginx 变量的匹配条件。 |
filter_func string | FilterFunc 是用于高级请求过滤的用户定义函数。该函数可以通过 vars 参数使用 Nginx 变量。此字段在 APISIX 中支持,但在 API7 企业版中不支持。 |
出现在:
ApisixRouteHTTPMatchExpr
ApisixRouteHTTPMatchExpr 表示用于基于 Nginx 变量匹配请求的二元表达式。
| 字段 | 描述 |
|---|---|
subject ApisixRouteHTTPMatchExprSubject | Subject 定义表达式的左侧。可以是任何内置变量或字符串字面量。 |
op string | Op 指定表达式中使用的运算符。可以是 Equal、NotEqual、GreaterThan、GreaterThanEqual、LessThan、LessThanEqual、RegexMatch、RegexNotMatch、RegexMatchCaseInsensitive、RegexNotMatchCaseInsensitive、In 或 NotIn。 |
set string 数组 | Set 提供表达式的可接受值列表。当 Op 为 In 或 NotIn 时应使用此字段。 |
value string | Value 定义要与 subject 进行比较的单个值。当 Op 不是 In 或 NotIn 时应使用此字段。Set 和 Value 是互斥的 — 一次只能设置其中一个。 |
出现在:
ApisixRouteHTTPMatchExprSubject
ApisixRouteHTTPMatchExprSubject 描述了路由匹配表达式的主体。
| 字段 | 描述 |
|---|---|
scope string | Scope 指定主体范围,可以是 Header、Query 或 Path。当 Scope 为 Path 时,Name 将被忽略。 |
name string | Name 是标头或查询参数的名称。 |
出现在:
ApisixRouteHTTPMatchExprs
基础类型 (Base type): ApisixRouteHTTPMatchExpr
| 字段 | 描述 |
|---|---|
subject ApisixRouteHTTPMatchExprSubject | Subject 定义表达式的左侧。可以是任何内置变量或字符串字面量。 |
op string | Op 指定表达式中使用的运算符。可以是 Equal、NotEqual、GreaterThan、GreaterThanEqual、LessThan、LessThanEqual、RegexMatch、RegexNotMatch、RegexMatchCaseInsensitive、RegexNotMatchCaseInsensitive、In 或 NotIn。 |
set string 数组 | Set 提供表达式的可接受值列表。当 Op 为 In 或 NotIn 时应使用此字段。 |
value string | Value 定义要与 subject 进行比较的单个值。当 Op 不是 In 或 NotIn 时应使用此字段。Set 和 Value 是互斥的 — 一次只能设置其中一个。 |
出现在: