@@ -29,6 +29,7 @@ type ApisixUpstreamSpec struct {
29
29
// ExternalNodes contains external nodes the Upstream should use
30
30
// If this field is set, the upstream will use these nodes directly without any further resolves
31
31
// +kubebuilder:validation:Optional
32
+ // +kubebuilder:validation:MinItems=1
32
33
ExternalNodes []ApisixUpstreamExternalNode `json:"externalNodes,omitempty" yaml:"externalNodes,omitempty"`
33
34
34
35
ApisixUpstreamConfig `json:",inline" yaml:",inline"`
@@ -81,6 +82,7 @@ type ApisixUpstreamConfig struct {
81
82
// The scheme used to talk with the upstream.
82
83
// Now value can be http, grpc.
83
84
// +kubebuilder:validation:Optional
85
+ // +kubebuilder:validation:Enum=http;https;grpc;grpcs;
84
86
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
85
87
86
88
// How many times that the proxy (Apache APISIX) should do when
@@ -92,6 +94,7 @@ type ApisixUpstreamConfig struct {
92
94
// +kubebuilder:validation:Optional
93
95
Timeout * UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"`
94
96
97
+ // Deprecated: this is no longer support on standalone mode.
95
98
// The health check configurations for the upstream.
96
99
// +kubebuilder:validation:Optional
97
100
HealthCheck * HealthCheck `json:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
@@ -108,13 +111,15 @@ type ApisixUpstreamConfig struct {
108
111
// Configures the host when the request is forwarded to the upstream.
109
112
// Can be one of pass, node or rewrite.
110
113
// +kubebuilder:validation:Optional
114
+ // +kubebuilder:validation:Enum=pass;node;rewrite;
111
115
PassHost string `json:"passHost,omitempty" yaml:"passHost,omitempty"`
112
116
113
117
// Specifies the host of the Upstream request. This is only valid if
114
118
// the pass_host is set to rewrite
115
119
// +kubebuilder:validation:Optional
116
120
UpstreamHost string `json:"upstreamHost,omitempty" yaml:"upstreamHost,omitempty"`
117
121
122
+ // Deprecated: this is no longer support on standalone mode.
118
123
// Discovery is used to configure service discovery for upstream.
119
124
// +kubebuilder:validation:Optional
120
125
Discovery * Discovery `json:"discovery,omitempty" yaml:"discovery,omitempty"`
@@ -145,7 +150,9 @@ type LoadBalancer struct {
145
150
146
151
// HealthCheck describes the upstream health check parameters.
147
152
type HealthCheck struct {
148
- Active * ActiveHealthCheck `json:"active" yaml:"active"`
153
+ // +kubebuilder:validation:Required
154
+ Active * ActiveHealthCheck `json:"active" yaml:"active"`
155
+ // +kubebuilder:validation:Optional
149
156
Passive * PassiveHealthCheck `json:"passive,omitempty" yaml:"passive,omitempty"`
150
157
}
151
158
@@ -159,17 +166,23 @@ type ApisixUpstreamSubset struct {
159
166
160
167
// Discovery defines Service discovery related configuration.
161
168
type 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"`
165
173
}
166
174
167
175
// ActiveHealthCheck defines the active kind of upstream health check.
168
176
type 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
173
186
Port int32 `json:"port,omitempty" yaml:"port,omitempty"`
174
187
HTTPPath string `json:"httpPath,omitempty" yaml:"httpPath,omitempty"`
175
188
StrictTLS * bool `json:"strictTLS,omitempty" yaml:"strictTLS,omitempty"`
@@ -205,17 +218,27 @@ type ActiveHealthCheckUnhealthy struct {
205
218
// PassiveHealthCheckHealthy defines the conditions to judge whether
206
219
// an upstream node is healthy with the passive manner.
207
220
type PassiveHealthCheckHealthy struct {
221
+ // +kubebuilder:validation:Optional
222
+ // +kubebuilder:validation:MinItems=1
208
223
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"`
210
227
}
211
228
212
229
// PassiveHealthCheckUnhealthy defines the conditions to judge whether
213
230
// an upstream node is unhealthy with the passive manager.
214
231
type 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"`
219
242
}
220
243
221
244
func init () {
0 commit comments