@@ -29,6 +29,7 @@ type ApisixUpstreamSpec struct {
2929 // ExternalNodes contains external nodes the Upstream should use
3030 // If this field is set, the upstream will use these nodes directly without any further resolves
3131 // +kubebuilder:validation:Optional
32+ // +kubebuilder:validation:MinItems=1
3233 ExternalNodes []ApisixUpstreamExternalNode `json:"externalNodes,omitempty" yaml:"externalNodes,omitempty"`
3334
3435 ApisixUpstreamConfig `json:",inline" yaml:",inline"`
@@ -81,6 +82,7 @@ type ApisixUpstreamConfig struct {
8182 // The scheme used to talk with the upstream.
8283 // Now value can be http, grpc.
8384 // +kubebuilder:validation:Optional
85+ // +kubebuilder:validation:Enum=http;https;grpc;grpcs;
8486 Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
8587
8688 // How many times that the proxy (Apache APISIX) should do when
@@ -92,6 +94,7 @@ type ApisixUpstreamConfig struct {
9294 // +kubebuilder:validation:Optional
9395 Timeout * UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"`
9496
97+ // Deprecated: this is no longer support on standalone mode.
9598 // The health check configurations for the upstream.
9699 // +kubebuilder:validation:Optional
97100 HealthCheck * HealthCheck `json:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
@@ -108,13 +111,15 @@ type ApisixUpstreamConfig struct {
108111 // Configures the host when the request is forwarded to the upstream.
109112 // Can be one of pass, node or rewrite.
110113 // +kubebuilder:validation:Optional
114+ // +kubebuilder:validation:Enum=pass;node;rewrite;
111115 PassHost string `json:"passHost,omitempty" yaml:"passHost,omitempty"`
112116
113117 // Specifies the host of the Upstream request. This is only valid if
114118 // the pass_host is set to rewrite
115119 // +kubebuilder:validation:Optional
116120 UpstreamHost string `json:"upstreamHost,omitempty" yaml:"upstreamHost,omitempty"`
117121
122+ // Deprecated: this is no longer support on standalone mode.
118123 // Discovery is used to configure service discovery for upstream.
119124 // +kubebuilder:validation:Optional
120125 Discovery * Discovery `json:"discovery,omitempty" yaml:"discovery,omitempty"`
@@ -145,7 +150,9 @@ type LoadBalancer struct {
145150
146151// HealthCheck describes the upstream health check parameters.
147152type HealthCheck struct {
148- Active * ActiveHealthCheck `json:"active" yaml:"active"`
153+ // +kubebuilder:validation:Required
154+ Active * ActiveHealthCheck `json:"active" yaml:"active"`
155+ // +kubebuilder:validation:Optional
149156 Passive * PassiveHealthCheck `json:"passive,omitempty" yaml:"passive,omitempty"`
150157}
151158
@@ -159,17 +166,23 @@ type ApisixUpstreamSubset struct {
159166
160167// Discovery defines Service discovery related configuration.
161168type Discovery struct {
162- ServiceName string `json:"serviceName" yaml:"serviceName"`
163- Type string `json:"type" yaml:"type"`
164- Args map [string ]string `json:"args,omitempty" yaml:"args,omitempty"`
169+ ServiceName string `json:"serviceName" yaml:"serviceName"`
170+ Type string `json:"type" yaml:"type"`
171+ // +kubebuilder:validation:Optional
172+ Args map [string ]string `json:"args,omitempty" yaml:"args,omitempty"`
165173}
166174
167175// ActiveHealthCheck defines the active kind of upstream health check.
168176type ActiveHealthCheck struct {
169- Type string `json:"type,omitempty" yaml:"type,omitempty"`
170- Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
171- Concurrency int `json:"concurrency,omitempty" yaml:"concurrency,omitempty"`
172- Host string `json:"host,omitempty" yaml:"host,omitempty"`
177+ // +kubebuilder:validation:Optional
178+ // +kubebuilder:validation:Enum=http;https;tcp;
179+ Type string `json:"type,omitempty" yaml:"type,omitempty"`
180+ Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
181+ // +kubebuilder:validation:Minimum=0
182+ Concurrency int `json:"concurrency,omitempty" yaml:"concurrency,omitempty"`
183+ Host string `json:"host,omitempty" yaml:"host,omitempty"`
184+ // +kubebuilder:validation:Minimum=0
185+ // +kubebuilder:validation:Maximum=65535
173186 Port int32 `json:"port,omitempty" yaml:"port,omitempty"`
174187 HTTPPath string `json:"httpPath,omitempty" yaml:"httpPath,omitempty"`
175188 StrictTLS * bool `json:"strictTLS,omitempty" yaml:"strictTLS,omitempty"`
@@ -205,17 +218,27 @@ type ActiveHealthCheckUnhealthy struct {
205218// PassiveHealthCheckHealthy defines the conditions to judge whether
206219// an upstream node is healthy with the passive manner.
207220type PassiveHealthCheckHealthy struct {
221+ // +kubebuilder:validation:Optional
222+ // +kubebuilder:validation:MinItems=1
208223 HTTPCodes []int `json:"httpCodes,omitempty" yaml:"httpCodes,omitempty"`
209- Successes int `json:"successes,omitempty" yaml:"successes,omitempty"`
224+ // +kubebuilder:validation:Minimum=0
225+ // +kubebuilder:validation:Maximum=254
226+ Successes int `json:"successes,omitempty" yaml:"successes,omitempty"`
210227}
211228
212229// PassiveHealthCheckUnhealthy defines the conditions to judge whether
213230// an upstream node is unhealthy with the passive manager.
214231type PassiveHealthCheckUnhealthy struct {
215- HTTPCodes []int `json:"httpCodes,omitempty" yaml:"httpCodes,omitempty"`
216- HTTPFailures int `json:"httpFailures,omitempty" yaml:"http_failures,omitempty"`
217- TCPFailures int `json:"tcpFailures,omitempty" yaml:"tcpFailures,omitempty"`
218- Timeouts int `json:"timeout,omitempty" yaml:"timeout,omitempty"`
232+ // +kubebuilder:validation:Optional
233+ // +kubebuilder:validation:MinItems=1
234+ HTTPCodes []int `json:"httpCodes,omitempty" yaml:"httpCodes,omitempty"`
235+ // +kubebuilder:validation:Minimum=0
236+ // +kubebuilder:validation:Maximum=254
237+ HTTPFailures int `json:"httpFailures,omitempty" yaml:"http_failures,omitempty"`
238+ // +kubebuilder:validation:Minimum=0
239+ // +kubebuilder:validation:Maximum=254
240+ TCPFailures int `json:"tcpFailures,omitempty" yaml:"tcpFailures,omitempty"`
241+ Timeouts int `json:"timeout,omitempty" yaml:"timeout,omitempty"`
219242}
220243
221244func init () {
0 commit comments