@@ -38,7 +38,7 @@ type ApisixRouteSpec struct {
3838 // Each rule specifies conditions to match HTTP requests and how to forward them.
3939 HTTP []ApisixRouteHTTP `json:"http,omitempty" yaml:"http,omitempty"`
4040 // Stream defines a list of stream route rules.
41- // Each rule specifies conditions to match TCP/UDP traffic and how to forward it .
41+ // Each rule specifies conditions to match TCP/UDP traffic and how to forward them .
4242 Stream []ApisixRouteStream `json:"stream,omitempty" yaml:"stream,omitempty"`
4343}
4444
@@ -86,7 +86,7 @@ type ApisixRouteHTTP struct {
8686 // Match defines the HTTP request matching criteria.
8787 Match ApisixRouteHTTPMatch `json:"match,omitempty" yaml:"match,omitempty"`
8888 // Backends lists potential backend services to proxy requests to.
89- // If more than one backend is specified, the traffic-split plugin is used
89+ // If more than one backend is specified, the ` traffic-split` plugin is used
9090 // to distribute traffic according to backend weights.
9191 Backends []ApisixRouteHTTPBackend `json:"backends,omitempty" yaml:"backends,omitempty"`
9292 // Upstreams references ApisixUpstream CRDs.
@@ -106,17 +106,17 @@ type ApisixRouteHTTP struct {
106106 Authentication ApisixRouteAuthentication `json:"authentication,omitempty" yaml:"authentication,omitempty"`
107107}
108108
109- // ApisixRouteStream defines configuration for a Layer 4 (TCP/UDP) route.
109+ // ApisixRouteStream defines the configuration for a Layer 4 (TCP/UDP) route.
110110type ApisixRouteStream struct {
111- // Name is the unique rule name and cannot be empty.
111+ // Name is a unique identifier for the route. This field must not be empty.
112112 Name string `json:"name" yaml:"name"`
113- // Protocol specifies the network protocol (e.g., " tcp", " udp") .
113+ // Protocol specifies the L4 protocol to match. Can be ` tcp` or ` udp` .
114114 Protocol string `json:"protocol" yaml:"protocol"`
115- // Match defines the matching criteria for the stream route .
115+ // Match defines the criteria used to match incoming TCP or UDP connections .
116116 Match ApisixRouteStreamMatch `json:"match" yaml:"match"`
117- // Backend specifies the backend service to proxy traffic to .
117+ // Backend specifies the destination service to which traffic should be forwarded .
118118 Backend ApisixRouteStreamBackend `json:"backend" yaml:"backend"`
119- // Plugins lists additional plugins applied to this stream route.
119+ // Plugins defines a list of plugins to apply to this route.
120120 Plugins []ApisixRoutePlugin `json:"plugins,omitempty" yaml:"plugins,omitempty"`
121121}
122122
@@ -130,42 +130,33 @@ type UpstreamTimeout struct {
130130 Read metav1.Duration `json:"read,omitempty" yaml:"read,omitempty"`
131131}
132132
133- // ApisixRouteHTTPMatch represents the matching conditions for routing HTTP traffic .
133+ // ApisixRouteHTTPMatch defines the conditions used to match incoming HTTP requests .
134134type ApisixRouteHTTPMatch struct {
135- // Paths is a list of URI path predicates .
136- // At least one path is required .
137- // Paths can be exact or prefix matches.
138- // For prefix matches, append "*" to the path, e.g., " /foo*" .
135+ // Paths is a list of URI path patterns to match .
136+ // At least one path must be specified .
137+ // Supports exact matches and prefix matches.
138+ // For prefix matches, append `*` to the path, such as ` /foo*` .
139139 Paths []string `json:"paths" yaml:"paths"`
140140
141- // Methods specifies HTTP request methods to match, e.g., GET, POST .
141+ // Methods specifies the HTTP methods to match.
142142 Methods []string `json:"methods,omitempty" yaml:"methods,omitempty"`
143143
144- // Hosts defines HTTP Host header predicates.
145- // Hosts can be exact domains or wildcard domains.
146- // Only one generic wildcard level is allowed, e.g., "*.foo.com" is valid, "*.*.foo.com" is not.
144+ // Hosts specifies Host header values to match.
145+ // Supports exact and wildcard domains.
146+ // Only one level of wildcard is allowed (e.g., `*.example.com` is valid,
147+ // but `*.*.example.com` is not).
147148 Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
148149
149- // RemoteAddrs is a list of remote IP addresses or CIDR ranges to match.
150+ // RemoteAddrs is a list of source IP addresses or CIDR ranges to match.
150151 // Supports both IPv4 and IPv6 formats.
151152 RemoteAddrs []string `json:"remoteAddrs,omitempty" yaml:"remoteAddrs,omitempty"`
152153
153- // NginxVars represents predicates based on standard Nginx variables.
154- // These include variables for request headers, query parameters, remote IP, and other Nginx runtime data.
155- // For example:
156- // ```
157- // nginxVars:
158- // - subject: "$remote_addr"
159- // op: in
160- // value:
161- // - "127.0.0.1"
162- // - "10.0.5.11"
163- // ```
154+ // NginxVars defines match conditions based on Nginx variables.
164155 NginxVars ApisixRouteHTTPMatchExprs `json:"exprs,omitempty" yaml:"exprs,omitempty"`
165156
166- // FilterFunc is a user-defined filtering function for advanced matching .
167- // The function receives `vars` parameter that can access Nginx variables .
168- // This configuration option is only available in APISIX, not in API7 Enterprise.
157+ // FilterFunc is a user-defined function for advanced request filtering .
158+ // The function can use Nginx variables through the `vars` parameter .
159+ // This field is supported in APISIX but not in API7 Enterprise.
169160 FilterFunc string `json:"filter_func,omitempty" yaml:"filter_func,omitempty"`
170161}
171162
@@ -184,23 +175,24 @@ type ApisixRoutePlugin struct {
184175 SecretRef string `json:"secretRef" yaml:"secretRef"`
185176}
186177
187- // ApisixRouteHTTPBackend represents an HTTP backend (a Kubernetes Service).
178+ // ApisixRouteHTTPBackend represents an HTTP backend (Kubernetes Service).
188179type ApisixRouteHTTPBackend struct {
189- // The name (short) of the service, note cross namespace is forbidden,
190- // so be sure the ApisixRoute and Service are in the same namespace.
180+ // ServiceName is the name of the Kubernetes Service.
181+ // Cross-namespace references are not supported—ensure the ApisixRoute
182+ // and the Service are in the same namespace.
191183 ServiceName string `json:"serviceName" yaml:"serviceName"`
192- // The service port, could be the name or the port number.
184+ // ServicePort is the port of the Kubernetes Service.
185+ // This can be either the port name or port number.
193186 ServicePort intstr.IntOrString `json:"servicePort" yaml:"servicePort"`
194- // The resolve granularity, can be "endpoints" or "service",
195- // when set to " endpoints", the pod ips will be used; other
196- // wise , the service ClusterIP or ExternalIP will be used,
197- // default is endpoints.
187+ // ResolveGranularity determines how the backend service is resolved.
188+ // Valid values are ` endpoints` and `service`. When set to `endpoints`,
189+ // individual pod IPs will be used; otherwise , the Service's ClusterIP or ExternalIP is used.
190+ // The default is ` endpoints` .
198191 ResolveGranularity string `json:"resolveGranularity,omitempty" yaml:"resolveGranularity,omitempty"`
199- // Weight of this backend.
200- // +kubebuilder:validation:Optional
192+ // Weight specifies the relative traffic weight for this backend.
201193 Weight * int `json:"weight" yaml:"weight"`
202- // Subset specifies a subset for the target Service. The subset should be pre-defined
203- // in ApisixUpstream about this service .
194+ // Subset specifies a named subset of the target Service.
195+ // The subset must be pre-defined in the corresponding ApisixUpstream resource .
204196 Subset string `json:"subset,omitempty" yaml:"subset,omitempty"`
205197}
206198
@@ -228,7 +220,7 @@ type ApisixRouteAuthentication struct {
228220 LDAPAuth ApisixRouteAuthenticationLDAPAuth `json:"ldapAuth,omitempty" yaml:"ldapAuth,omitempty"`
229221}
230222
231- // ApisixRouteStreamMatch represents the match conditions for a stream route.
223+ // ApisixRouteStreamMatch represents the matching conditions for a stream route.
232224type ApisixRouteStreamMatch struct {
233225 // IngressPort is the port on which the APISIX Ingress proxy server listens.
234226 // This must be a statically configured port, as APISIX does not support dynamic port binding.
@@ -237,40 +229,43 @@ type ApisixRouteStreamMatch struct {
237229 Host string `json:"host,omitempty" yaml:"host,omitempty"`
238230}
239231
240- // ApisixRouteStreamBackend represents a TCP backend (a Kubernetes Service) .
232+ // ApisixRouteStreamBackend represents the backend service for a TCP or UDP stream route .
241233type ApisixRouteStreamBackend struct {
242- // The name (short) of the service, note cross namespace is forbidden,
243- // so be sure the ApisixRoute and Service are in the same namespace.
234+ // ServiceName is the name of the Kubernetes Service.
235+ // Cross-namespace references are not supported—ensure the ApisixRoute
236+ // and the Service are in the same namespace.
244237 ServiceName string `json:"serviceName" yaml:"serviceName"`
245- // The service port, could be the name or the port number.
238+ // ServicePort is the port of the Kubernetes Service.
239+ // This can be either the port name or port number.
246240 ServicePort intstr.IntOrString `json:"servicePort" yaml:"servicePort"`
247- // The resolve granularity, can be "endpoints" or "service",
248- // when set to " endpoints", the pod ips will be used; other
249- // wise , the service ClusterIP or ExternalIP will be used,
250- // default is endpoints.
241+ // ResolveGranularity determines how the backend service is resolved.
242+ // Valid values are ` endpoints` and `service`. When set to `endpoints`,
243+ // individual pod IPs will be used; otherwise , the Service's ClusterIP or ExternalIP is used.
244+ // The default is ` endpoints` .
251245 ResolveGranularity string `json:"resolveGranularity,omitempty" yaml:"resolveGranularity,omitempty"`
252- // Subset specifies a subset for the target Service. The subset should be pre-defined
253- // in ApisixUpstream about this service .
246+ // Subset specifies a named subset of the target Service.
247+ // The subset must be pre-defined in the corresponding ApisixUpstream resource .
254248 Subset string `json:"subset,omitempty" yaml:"subset,omitempty"`
255249}
256250
257251// ApisixRouteHTTPMatchExpr represents a binary expression used to match requests based on Nginx variables.
258252type ApisixRouteHTTPMatchExpr struct {
259253 // Subject defines the left-hand side of the expression.
260- // It can be any Nginx variable or literal string, such as `$remote_addr` or `$http_user_agent` .
254+ // It can be any [built-in variable](/apisix/reference/built-in-variables) or string literal .
261255 Subject ApisixRouteHTTPMatchExprSubject `json:"subject" yaml:"subject"`
262256
263257 // Op specifies the operator used in the expression.
264- // See [APISIX expressions](/apisix/reference/apisix-expressions) for more information.
258+ // Can be `Equal`, `NotEqual`, `GreaterThan`, `GreaterThanEqual`, `LessThan`, `LessThanEqual`, `RegexMatch`,
259+ // `RegexNotMatch`, `RegexMatchCaseInsensitive`, `RegexNotMatchCaseInsensitive`, `In`, or `NotIn`.
265260 Op string `json:"op" yaml:"op"`
266261
267262 // Set provides a list of acceptable values for the expression.
268- // This should be used when Op is `in ` or `not_in `.
263+ // This should be used when Op is `In ` or `NotIn `.
269264 // +kubebuilder:validation:Optional
270265 Set []string `json:"set" yaml:"set"`
271266
272267 // Value defines a single value to compare against the subject.
273- // This should be used when Op is not `in ` or `not_in `.
268+ // This should be used when Op is not `In ` or `NotIn `.
274269 // Set and Value are mutually exclusive—only one should be set at a time.
275270 // +kubebuilder:validation:Optional
276271 Value * string `json:"value" yaml:"value"`
@@ -399,10 +394,10 @@ type ApisixRouteAuthenticationLDAPAuth struct {
399394 UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
400395}
401396
402- // ApisixRouteHTTPMatchExprSubject describes the subject of a route match expression.
397+ // ApisixRouteHTTPMatchExprSubject describes the subject of a route matching expression.
403398type ApisixRouteHTTPMatchExprSubject struct {
404399 // Scope specifies the subject scope and can be `Header`, `Query`, or `Path`.
405- // When Scope is `Path`, ` Name` will be ignored.
400+ // When Scope is `Path`, Name will be ignored.
406401 Scope string `json:"scope" yaml:"scope"`
407402 // Name is the name of the header or query parameter.
408403 Name string `json:"name" yaml:"name"`
0 commit comments