Skip to content

Commit 63397b4

Browse files
kayx23ronething
andauthored
docs: update CRD docs (#192)
Signed-off-by: ashing <[email protected]> Co-authored-by: ashing <[email protected]>
1 parent 7b5b516 commit 63397b4

31 files changed

+1309
-900
lines changed

api/adc/types.go

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ type ClientTLS struct {
244244
Key string `json:"client_key,omitempty" yaml:"client_key,omitempty"`
245245
}
246246

247-
// UpstreamActiveHealthCheck defines the active kind of upstream health check.
247+
// UpstreamActiveHealthCheck defines the active upstream health check configuration.
248248
// +k8s:deepcopy-gen=true
249249
type UpstreamActiveHealthCheck struct {
250250
Type string `json:"type,omitempty" yaml:"type,omitempty"`
@@ -259,33 +259,35 @@ type UpstreamActiveHealthCheck struct {
259259
Unhealthy UpstreamActiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
260260
}
261261

262-
// UpstreamPassiveHealthCheck defines the passive kind of upstream health check.
262+
// UpstreamPassiveHealthCheck defines the passive health check configuration for an upstream.
263+
// Passive health checks rely on analyzing live traffic to determine the health status of upstream nodes.
263264
// +k8s:deepcopy-gen=true
264265
type UpstreamPassiveHealthCheck struct {
265-
Type string `json:"type,omitempty" yaml:"type,omitempty"`
266-
Healthy UpstreamPassiveHealthCheckHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"`
266+
// Type is the passive health check type. For example: `http`.
267+
Type string `json:"type,omitempty" yaml:"type,omitempty"`
268+
// Healthy defines the conditions under which an upstream node is considered healthy.
269+
Healthy UpstreamPassiveHealthCheckHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"`
270+
// Unhealthy defines the conditions under which an upstream node is considered unhealthy.
267271
Unhealthy UpstreamPassiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
268272
}
269273

270-
// UpstreamActiveHealthCheckHealthy defines the conditions to judge whether
271-
// an upstream node is healthy with the active manner.
274+
// UpstreamActiveHealthCheckHealthy defines the conditions used to actively determine whether an upstream node is healthy.
272275
// +k8s:deepcopy-gen=true
273276
type UpstreamActiveHealthCheckHealthy struct {
274277
UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"`
275278

279+
// Interval defines the time interval for checking targets, in seconds.
276280
Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
277281
}
278282

279-
// UpstreamPassiveHealthCheckHealthy defines the conditions to judge whether
280-
// an upstream node is healthy with the passive manner.
283+
// UpstreamPassiveHealthCheckHealthy defines the conditions used to passively determine whether an upstream node is healthy.
281284
// +k8s:deepcopy-gen=true
282285
type UpstreamPassiveHealthCheckHealthy struct {
283286
HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
284287
Successes int `json:"successes,omitempty" yaml:"successes,omitempty"`
285288
}
286289

287-
// UpstreamPassiveHealthCheckUnhealthy defines the conditions to judge whether
288-
// an upstream node is unhealthy with the passive manager.
290+
// UpstreamPassiveHealthCheckUnhealthy defines the conditions used to passively determine whether an upstream node is unhealthy.
289291
// +k8s:deepcopy-gen=true
290292
type UpstreamPassiveHealthCheckUnhealthy struct {
291293
HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
@@ -294,12 +296,12 @@ type UpstreamPassiveHealthCheckUnhealthy struct {
294296
Timeouts int `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
295297
}
296298

297-
// UpstreamActiveHealthCheckUnhealthy defines the conditions to judge whether
298-
// an upstream node is unhealthy with the active manager.
299+
// UpstreamActiveHealthCheckHealthy defines the conditions used to actively determine whether an upstream node is unhealthy.
299300
// +k8s:deepcopy-gen=true
300301
type UpstreamActiveHealthCheckUnhealthy struct {
301302
UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"`
302303

304+
// Interval defines the time interval for checking targets, in seconds.
303305
Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
304306
}
305307

@@ -315,21 +317,38 @@ type TrafficSplitConfigRule struct {
315317
WeightedUpstreams []TrafficSplitConfigRuleWeightedUpstream `json:"weighted_upstreams"`
316318
}
317319

318-
// TrafficSplitConfigRuleWeightedUpstream is the weighted upstream config in
319-
// the traffic split plugin rule.
320+
// TrafficSplitConfigRuleWeightedUpstream defines a weighted backend in a traffic split rule.
321+
// This is used by the APISIX traffic-split plugin to distribute traffic
322+
// across multiple upstreams based on weight.
320323
// +k8s:deepcopy-gen=true
321324
type TrafficSplitConfigRuleWeightedUpstream struct {
322-
UpstreamID string `json:"upstream_id,omitempty"`
323-
Upstream *Upstream `json:"upstream,omitempty"`
324-
Weight int `json:"weight"`
325+
// UpstreamID is the identifier of a pre-defined upstream.
326+
UpstreamID string `json:"upstream_id,omitempty"`
327+
328+
// Upstream specifies upstream configuration.
329+
// If provided, it overrides UpstreamID.
330+
Upstream *Upstream `json:"upstream,omitempty"`
331+
332+
// Weight defines the percentage of traffic routed to this upstream.
333+
// The final routing decision is based on relative weights.
334+
Weight int `json:"weight"`
325335
}
326336

337+
// TLSClass defines the client TLS configuration for mutual TLS (mTLS) authentication.
327338
// +k8s:deepcopy-gen=true
328339
type TLSClass struct {
329-
ClientCERT string `json:"client_cert,omitempty"`
340+
// ClientCERT is the PEM-encoded client certificate.
341+
ClientCERT string `json:"client_cert,omitempty"`
342+
343+
// ClientCERTID is the reference ID to a stored client certificate.
330344
ClientCERTID string `json:"client_cert_id,omitempty"`
331-
ClientKey string `json:"client_key,omitempty"`
332-
Verify *bool `json:"verify,omitempty"`
345+
346+
// ClientKey is the PEM-encoded private key for the client certificate.
347+
ClientKey string `json:"client_key,omitempty"`
348+
349+
// Verify indicates whether the server's certificate should be verified.
350+
// If false, TLS verification is skipped.
351+
Verify *bool `json:"verify,omitempty"`
333352
}
334353

335354
// +k8s:deepcopy-gen=true

api/dashboard/v1/types.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ type UpstreamHealthCheck struct {
431431
Passive *UpstreamPassiveHealthCheck `json:"passive,omitempty" yaml:"passive,omitempty"`
432432
}
433433

434-
// UpstreamActiveHealthCheck defines the active kind of upstream health check.
434+
// UpstreamActiveHealthCheck defines the active upstream health check.
435435
// +k8s:deepcopy-gen=true
436436
type UpstreamActiveHealthCheck struct {
437437
Type string `json:"type,omitempty" yaml:"type,omitempty"`
@@ -446,42 +446,40 @@ type UpstreamActiveHealthCheck struct {
446446
Unhealthy UpstreamActiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
447447
}
448448

449-
// UpstreamPassiveHealthCheck defines the passive kind of upstream health check.
449+
// UpstreamPassiveHealthCheck defines the passive upstream health check.
450450
// +k8s:deepcopy-gen=true
451451
type UpstreamPassiveHealthCheck struct {
452452
Type string `json:"type,omitempty" yaml:"type,omitempty"`
453453
Healthy UpstreamPassiveHealthCheckHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"`
454454
Unhealthy UpstreamPassiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
455455
}
456456

457-
// UpstreamActiveHealthCheckHealthy defines the conditions to judge whether
458-
// an upstream node is healthy with the active manner.
457+
// UpstreamActiveHealthCheckHealthy defines the conditions used to actively determine whether an upstream node is healthy.
459458
// +k8s:deepcopy-gen=true
460459
type UpstreamActiveHealthCheckHealthy struct {
461460
UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"`
462461

462+
// Interval defines the time interval for checking targets, in seconds.
463463
Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
464464
}
465465

466-
// UpstreamPassiveHealthCheckHealthy defines the conditions to judge whether
467-
// an upstream node is healthy with the passive manner.
466+
// UpstreamPassiveHealthCheckHealthy defines the conditions used to passively determine whether an upstream node is unhealthy.
468467
// +k8s:deepcopy-gen=true
469468
type UpstreamPassiveHealthCheckHealthy struct {
470469
HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
471470
Successes int `json:"successes,omitempty" yaml:"successes,omitempty"`
472471
}
473472

474-
// UpstreamActiveHealthCheckUnhealthy defines the conditions to judge whether
475-
// an upstream node is unhealthy with the active manager.
473+
// UpstreamActiveHealthCheckUnhealthy defines the conditions used to actively determine whether an upstream node is unhealthy.
476474
// +k8s:deepcopy-gen=true
477475
type UpstreamActiveHealthCheckUnhealthy struct {
478476
UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"`
479477

478+
// Interval defines the time interval for checking targets, in seconds.
480479
Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
481480
}
482481

483-
// UpstreamPassiveHealthCheckUnhealthy defines the conditions to judge whether
484-
// an upstream node is unhealthy with the passive manager.
482+
// UpstreamPassiveHealthCheckUnhealthy defines the conditions used to passively determine whether an upstream node is unhealthy.
485483
// +k8s:deepcopy-gen=true
486484
type UpstreamPassiveHealthCheckUnhealthy struct {
487485
HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`

api/v1alpha1/backendtrafficpolicy_types.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
// +kubebuilder:object:root=true
2525
// +kubebuilder:subresource:status
26+
// BackendTrafficPolicy defines configuration for traffic handling policies applied to backend services.
2627
type BackendTrafficPolicy struct {
2728
metav1.TypeMeta `json:",inline"`
2829
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -46,7 +47,7 @@ type BackendTrafficPolicySpec struct {
4647
LoadBalancer *LoadBalancer `json:"loadbalancer,omitempty" yaml:"loadbalancer,omitempty"`
4748
// Scheme is the protocol used to communicate with the upstream.
4849
// Default is `http`.
49-
// Can be one of `http`, `https`, `grpc`, or `grpcs`.
50+
// Can be `http`, `https`, `grpc`, or `grpcs`.
5051
// +kubebuilder:validation:Enum=http;https;grpc;grpcs;
5152
// +kubebuilder:default=http
5253
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
@@ -61,8 +62,10 @@ type BackendTrafficPolicySpec struct {
6162

6263
// PassHost configures how the host header should be determined when a
6364
// request is forwarded to the upstream.
64-
// Default is `pass`.
65-
// Can be one of `pass`, `node` or `rewrite`.
65+
// Default is `pass`. Can be `pass`, `node` or `rewrite`:
66+
// * `pass`: preserve the original Host header
67+
// * `node`: use the upstream node’s host
68+
// * `rewrite`: set to a custom host via `upstreamHost`
6669
//
6770
// +kubebuilder:validation:Enum=pass;node;rewrite;
6871
// +kubebuilder:default=pass
@@ -76,20 +79,20 @@ type BackendTrafficPolicySpec struct {
7679
// LoadBalancer describes the load balancing parameters.
7780
// +kubebuilder:validation:XValidation:rule="!(has(self.key) && self.type != 'chash')"
7881
type LoadBalancer struct {
79-
// Type specifies the load balancing algorithms.
82+
// Type specifies the load balancing algorithms to route traffic to the backend.
8083
// Default is `roundrobin`.
81-
// Can be one of `roundrobin`, `chash`, `ewma`, or `least_conn`.
84+
// Can be `roundrobin`, `chash`, `ewma`, or `least_conn`.
8285
// +kubebuilder:validation:Enum=roundrobin;chash;ewma;least_conn;
8386
// +kubebuilder:default=roundrobin
8487
// +kubebuilder:validation:Required
8588
Type string `json:"type" yaml:"type"`
86-
// HashOn specified the type of field used for hashing, required when Type is `chash`.
89+
// HashOn specified the type of field used for hashing, required when type is `chash`.
8790
// Default is `vars`.
88-
// Can be one of `vars`, `header`, `cookie`, `consumer`, or `vars_combinations`.
91+
// Can be `vars`, `header`, `cookie`, `consumer`, or `vars_combinations`.
8992
// +kubebuilder:validation:Enum=vars;header;cookie;consumer;vars_combinations;
9093
// +kubebuilder:default=vars
9194
HashOn string `json:"hashOn,omitempty" yaml:"hashOn,omitempty"`
92-
// Key is used with HashOn, generally required when Type is `chash`.
95+
// Key is used with HashOn, generally required when type is `chash`.
9396
// When HashOn is `header` or `cookie`, specifies the name of the header or cookie.
9497
// When HashOn is `consumer`, key is not required, as the consumer name is used automatically.
9598
// When HashOn is `vars` or `vars_combinations`, key refers to one or a combination of

api/v1alpha1/consumer_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ import (
2424

2525
// +kubebuilder:object:root=true
2626
// +kubebuilder:subresource:status
27+
// Consumer defines configuration for a consumer.
2728
type Consumer struct {
2829
metav1.TypeMeta `json:",inline"`
2930
metav1.ObjectMeta `json:"metadata,omitempty"`
3031

31-
// ConsumerSpec defines the configuration for a consumer, including consumer name,
32+
// ConsumerSpec defines configuration for a consumer, including consumer name,
3233
// authentication credentials, and plugin settings.
3334
Spec ConsumerSpec `json:"spec,omitempty"`
3435
Status ConsumerStatus `json:"status,omitempty"`
@@ -65,7 +66,7 @@ type Credential struct {
6566
// +kubebuilder:validation:Required
6667
// +kubebuilder:validation:Enum=jwt-auth;basic-auth;key-auth;hmac-auth;
6768
// Type specifies the type of authentication to configure credentials for.
68-
// Can be one of `jwt-auth`, `basic-auth`, `key-auth`, or `hmac-auth`.
69+
// Can be `jwt-auth`, `basic-auth`, `key-auth`, or `hmac-auth`.
6970
Type string `json:"type"`
7071
// Config specifies the credential details for authentication.
7172
Config apiextensionsv1.JSON `json:"config,omitempty"`

api/v1alpha1/gatewayproxy_types.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type GatewayProxySpec struct {
3737
Provider *GatewayProxyProvider `json:"provider,omitempty"`
3838
// Plugins configure global plugins.
3939
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
40-
// PluginMetadata configures common configurations shared by all plugin instances of the same name.
40+
// PluginMetadata configures common configuration shared by all plugin instances of the same name.
4141
PluginMetadata map[string]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
4242
}
4343

@@ -112,7 +112,7 @@ type ControlPlaneAuth struct {
112112
AdminKey *AdminKeyAuth `json:"adminKey,omitempty"`
113113
}
114114

115-
// ControlPlaneProvider defines the configuration for control plane provider.
115+
// ControlPlaneProvider defines configuration for control plane provider.
116116
// +kubebuilder:validation:XValidation:rule="has(self.endpoints) != has(self.service)"
117117
type ControlPlaneProvider struct {
118118
// Endpoints specifies the list of control plane endpoints.
@@ -125,26 +125,28 @@ type ControlPlaneProvider struct {
125125
// +optional
126126
TlsVerify *bool `json:"tlsVerify,omitempty"`
127127

128-
// Auth specifies the authentication configurations.
128+
// Auth specifies the authentication configuration.
129129
// +kubebuilder:validation:Required
130130
Auth ControlPlaneAuth `json:"auth"`
131131
}
132132

133133
type ProviderService struct {
134+
// Name is the name of the provider.
134135
Name string `json:"name"`
135136

136137
// +kubebuilder:validation:Minimum=1
137138
// +kubebuilder:validation:Maximum=65535
139+
// Port is the port of the provider.
138140
Port int32 `json:"port,omitempty"`
139141
}
140142

141143
// +kubebuilder:object:root=true
142-
// GatewayProxy is the Schema for the gatewayproxies API.
144+
// GatewayProxy defines configuration for the gateway proxy instances used to route traffic to services.
143145
type GatewayProxy struct {
144146
metav1.TypeMeta `json:",inline"`
145147
metav1.ObjectMeta `json:"metadata,omitempty"`
146148

147-
// GatewayProxySpec defines the desired state and configuration of a GatewayProxy,
149+
// GatewayProxySpec defines configuration of gateway proxy instances,
148150
// including networking settings, global plugins, and plugin metadata.
149151
Spec GatewayProxySpec `json:"spec,omitempty"`
150152
}
@@ -157,7 +159,7 @@ type GatewayProxyList struct {
157159
Items []GatewayProxy `json:"items"`
158160
}
159161

160-
// GatewayProxyPlugin contains plugin configurations.
162+
// GatewayProxyPlugin contains plugin configuration.
161163
type GatewayProxyPlugin struct {
162164
// Name is the name of the plugin.
163165
Name string `json:"name,omitempty"`

api/v1alpha1/groupversion_info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
// Package v1alpha1 contains API Schema definitions for the apisix.apache.org v1alpha1 API group
18+
// Package v1alpha1 contains API Schema definitions for the apisix.apache.org v1alpha1 API group.
1919
// +kubebuilder:object:generate=true
2020
// +groupName=apisix.apache.org
2121
package v1alpha1

api/v1alpha1/httproutepolicy_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ type HTTPRoutePolicySpec struct {
2929
// +kubebuilder:validation:MinItems=1
3030
// +kubebuilder:validation:MaxItems=16
3131
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReferenceWithSectionName `json:"targetRefs"`
32-
// Priority sets the priority for route. A higher value sets a higher priority in route matching.
32+
// Priority sets the priority for route. when multiple routes have the same URI path,
33+
// a higher value sets a higher priority in route matching.
3334
Priority *int64 `json:"priority,omitempty" yaml:"priority,omitempty"`
3435
// Vars sets the request matching conditions.
3536
Vars []apiextensionsv1.JSON `json:"vars,omitempty" yaml:"vars,omitempty"`
@@ -38,12 +39,12 @@ type HTTPRoutePolicySpec struct {
3839
// +kubebuilder:object:root=true
3940
// +kubebuilder:subresource:status
4041

41-
// HTTPRoutePolicy is the Schema for the httproutepolicies API.
42+
// HTTPRoutePolicy defines configuration of traffic policies.
4243
type HTTPRoutePolicy struct {
4344
metav1.TypeMeta `json:",inline"`
4445
metav1.ObjectMeta `json:"metadata,omitempty"`
4546

46-
// HTTPRoutePolicySpec defines the desired state and configuration of a HTTPRoutePolicy,
47+
// HTTPRoutePolicySpec defines configuration of a HTTPRoutePolicy,
4748
// including route priority and request matching conditions.
4849
Spec HTTPRoutePolicySpec `json:"spec,omitempty"`
4950
Status PolicyStatus `json:"status,omitempty"`

api/v1alpha1/pluginconfig_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ import (
2727

2828
// +kubebuilder:object:root=true
2929

30-
// PluginConfig is the Schema for the PluginConfigs API.
30+
// PluginConfig defines plugin configuration.
3131
type PluginConfig struct {
3232
metav1.TypeMeta `json:",inline"`
3333
metav1.ObjectMeta `json:"metadata,omitempty"`
3434

3535
// PluginConfigSpec defines the desired state of a PluginConfig,
36-
// in which plugins and their configurations are specified.
36+
// in which plugins and their configuration are specified.
3737
Spec PluginConfigSpec `json:"spec,omitempty"`
3838
}
3939

4040
// PluginConfigSpec defines the desired state of PluginConfig.
4141
type PluginConfigSpec struct {
42-
// Plugins are an array of plugins and their configurations to be applied.
42+
// Plugins are an array of plugins and their configuration to be applied.
4343
Plugins []Plugin `json:"plugins"`
4444
}
4545

0 commit comments

Comments
 (0)