Skip to content

Commit 5ddd55a

Browse files
authored
feat: support deployment of multiple data plane modes (#2647) (#379)
1 parent 2479107 commit 5ddd55a

33 files changed

Lines changed: 408 additions & 483 deletions

api/adc/types.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,12 +692,22 @@ const (
692692
)
693693

694694
type SyncResult struct {
695-
Status string `json:"status"`
696-
TotalResources int `json:"total_resources"`
697-
SuccessCount int `json:"success_count"`
698-
FailedCount int `json:"failed_count"`
699-
Success []SyncStatus `json:"success"`
700-
Failed []SyncStatus `json:"failed"`
695+
Status string `json:"status"`
696+
TotalResources int `json:"total_resources"`
697+
SuccessCount int `json:"success_count"`
698+
FailedCount int `json:"failed_count"`
699+
Success []SyncStatus `json:"success"`
700+
Failed []SyncStatus `json:"failed"`
701+
EndpointStatus []EndpointStatus `json:"endpoint_status,omitempty"`
702+
}
703+
704+
// EndpointStatus represents the synchronization status of an APISIX standalone endpoint.
705+
// This is only used in apisix-standalone mode where endpoint-level status is reported
706+
// instead of resource-level status.
707+
type EndpointStatus struct {
708+
Server string `json:"server"`
709+
Success bool `json:"success"`
710+
Reason string `json:"reason,omitempty"`
701711
}
702712

703713
type SyncStatus struct {
@@ -778,6 +788,7 @@ type Config struct {
778788
ServerAddrs []string
779789
Token string
780790
TlsVerify bool
791+
BackendType string
781792
}
782793

783794
// MarshalJSON implements custom JSON marshaling for adcConfig

api/v1alpha1/gatewayproxy_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ type ControlPlaneAuth struct {
119119

120120
// ControlPlaneProvider defines configuration for control plane provider.
121121
// +kubebuilder:validation:XValidation:rule="has(self.endpoints) != has(self.service)"
122+
// +kubebuilder:validation:XValidation:rule="oldSelf == null || (!has(self.mode) && !has(oldSelf.mode)) || self.mode == oldSelf.mode",message="mode is immutable"
122123
type ControlPlaneProvider struct {
124+
// Mode specifies the mode of control plane provider.
125+
// Can be `apisix` or `apisix-standalone`.
126+
//
127+
// +kubebuilder:validation:Optional
128+
Mode string `json:"mode,omitempty"`
123129
// Endpoints specifies the list of control plane endpoints.
124130
// +kubebuilder:validation:Optional
125131
// +kubebuilder:validation:MinItems=1

api/v2/apisixroute_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type ApisixRouteStatus = ApisixStatus
6161
// +kubebuilder:printcolumn:name="Target Service (TCP)",type="string",JSONPath=".spec.tcp[].match.backend.serviceName",description="Backend Service for TCP",priority=1
6262
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Creation time",priority=0
6363

64-
// ApisixRoute is defines configuration for HTTP and stream routes.
64+
// ApisixRoute defines configuration for HTTP and stream routes.
6565
type ApisixRoute struct {
6666
metav1.TypeMeta `json:",inline"`
6767
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -112,7 +112,7 @@ type ApisixRouteHTTP struct {
112112
Authentication ApisixRouteAuthentication `json:"authentication,omitempty" yaml:"authentication,omitempty"`
113113
}
114114

115-
// ApisixRouteStream defines the configuration for a Layer 4 (TCP/UDP) route. Currently not supported.
115+
// ApisixRouteStream defines the configuration for a Layer 4 (TCP/UDP) route.
116116
type ApisixRouteStream struct {
117117
// Name is a unique identifier for the route. This field must not be empty.
118118
Name string `json:"name" yaml:"name"`

config/crd/bases/apisix.apache.org_apisixroutes.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
name: v2
4848
schema:
4949
openAPIV3Schema:
50-
description: ApisixRoute is defines configuration for HTTP and stream routes.
50+
description: ApisixRoute defines configuration for HTTP and stream routes.
5151
properties:
5252
apiVersion:
5353
description: |-
@@ -361,7 +361,7 @@ spec:
361361
Each rule specifies conditions to match TCP/UDP traffic and how to forward them.
362362
items:
363363
description: ApisixRouteStream defines the configuration for a Layer
364-
4 (TCP/UDP) route. Currently not supported.
364+
4 (TCP/UDP) route.
365365
properties:
366366
backend:
367367
description: Backend specifies the destination service to which

config/crd/bases/apisix.apache.org_gatewayproxies.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ spec:
127127
type: string
128128
minItems: 1
129129
type: array
130+
mode:
131+
description: |-
132+
Mode specifies the mode of control plane provider.
133+
Can be `apisix` or `apisix-standalone`.
134+
type: string
130135
service:
131136
properties:
132137
name:
@@ -150,6 +155,9 @@ spec:
150155
type: object
151156
x-kubernetes-validations:
152157
- rule: has(self.endpoints) != has(self.service)
158+
- message: mode is immutable
159+
rule: oldSelf == null || (!has(self.mode) && !has(oldSelf.mode))
160+
|| self.mode == oldSelf.mode
153161
type:
154162
description: Type specifies the type of provider. Can only be
155163
`ControlPlane`.

config/webhook/manifests.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ webhooks:
1111
name: webhook-service
1212
namespace: system
1313
path: /validate-apisix-apache-org-v2-apisixconsumer
14-
failurePolicy: Fail
14+
failurePolicy: Ignore
1515
name: vapisixconsumer-v2.kb.io
1616
rules:
1717
- apiGroups:
@@ -31,7 +31,7 @@ webhooks:
3131
name: webhook-service
3232
namespace: system
3333
path: /validate-apisix-apache-org-v2-apisixroute
34-
failurePolicy: Fail
34+
failurePolicy: Ignore
3535
name: vapisixroute-v2.kb.io
3636
rules:
3737
- apiGroups:
@@ -51,7 +51,7 @@ webhooks:
5151
name: webhook-service
5252
namespace: system
5353
path: /validate-apisix-apache-org-v2-apisixtls
54-
failurePolicy: Fail
54+
failurePolicy: Ignore
5555
name: vapisixtls-v2.kb.io
5656
rules:
5757
- apiGroups:
@@ -71,7 +71,7 @@ webhooks:
7171
name: webhook-service
7272
namespace: system
7373
path: /validate-apisix-apache-org-v1alpha1-consumer
74-
failurePolicy: Fail
74+
failurePolicy: Ignore
7575
name: vconsumer-v1alpha1.kb.io
7676
rules:
7777
- apiGroups:
@@ -91,7 +91,7 @@ webhooks:
9191
name: webhook-service
9292
namespace: system
9393
path: /validate-gateway-networking-k8s-io-v1-gateway
94-
failurePolicy: Fail
94+
failurePolicy: Ignore
9595
name: vgateway-v1.kb.io
9696
rules:
9797
- apiGroups:
@@ -111,7 +111,7 @@ webhooks:
111111
name: webhook-service
112112
namespace: system
113113
path: /validate-apisix-apache-org-v1alpha1-gatewayproxy
114-
failurePolicy: Fail
114+
failurePolicy: Ignore
115115
name: vgatewayproxy-v1alpha1.kb.io
116116
rules:
117117
- apiGroups:
@@ -131,7 +131,7 @@ webhooks:
131131
name: webhook-service
132132
namespace: system
133133
path: /validate-gateway-networking-k8s-io-v1-grpcroute
134-
failurePolicy: Fail
134+
failurePolicy: Ignore
135135
name: vgrpcroute-v1.kb.io
136136
rules:
137137
- apiGroups:
@@ -151,7 +151,7 @@ webhooks:
151151
name: webhook-service
152152
namespace: system
153153
path: /validate-gateway-networking-k8s-io-v1-httproute
154-
failurePolicy: Fail
154+
failurePolicy: Ignore
155155
name: vhttproute-v1.kb.io
156156
rules:
157157
- apiGroups:
@@ -171,7 +171,7 @@ webhooks:
171171
name: webhook-service
172172
namespace: system
173173
path: /validate-networking-k8s-io-v1-ingress
174-
failurePolicy: Fail
174+
failurePolicy: Ignore
175175
name: vingress-v1.kb.io
176176
rules:
177177
- apiGroups:
@@ -191,7 +191,7 @@ webhooks:
191191
name: webhook-service
192192
namespace: system
193193
path: /validate-networking-k8s-io-v1-ingressclass
194-
failurePolicy: Fail
194+
failurePolicy: Ignore
195195
name: vingressclass-v1.kb.io
196196
rules:
197197
- apiGroups:
@@ -211,7 +211,7 @@ webhooks:
211211
name: webhook-service
212212
namespace: system
213213
path: /validate-gateway-networking-k8s-io-v1alpha2-tcproute
214-
failurePolicy: Fail
214+
failurePolicy: Ignore
215215
name: vtcproute-v1alpha2.kb.io
216216
rules:
217217
- apiGroups:
@@ -231,7 +231,7 @@ webhooks:
231231
name: webhook-service
232232
namespace: system
233233
path: /validate-gateway-networking-k8s-io-v1alpha2-udproute
234-
failurePolicy: Fail
234+
failurePolicy: Ignore
235235
name: vudproute-v1alpha2.kb.io
236236
rules:
237237
- apiGroups:

docs/en/latest/reference/api-reference.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ ControlPlaneProvider defines configuration for control plane provider.
229229

230230
| Field | Description |
231231
| --- | --- |
232+
| `mode` _string_ | Mode specifies the mode of control plane provider. Can be `apisix` or `apisix-standalone`. |
232233
| `endpoints` _string array_ | Endpoints specifies the list of control plane endpoints. |
233234
| `service` _[ProviderService](#providerservice)_ | |
234235
| `tlsVerify` _boolean_ | TlsVerify specifies whether to verify the TLS certificate of the control plane. |
@@ -560,7 +561,7 @@ ApisixPluginConfig defines a reusable set of plugin configuration that can be re
560561
### ApisixRoute
561562

562563

563-
ApisixRoute is defines configuration for HTTP and stream routes.
564+
ApisixRoute defines configuration for HTTP and stream routes.
564565

565566
<!-- ApisixRoute resource -->
566567

@@ -1187,7 +1188,7 @@ _Appears in:_
11871188
#### ApisixRouteStream
11881189

11891190

1190-
ApisixRouteStream defines the configuration for a Layer 4 (TCP/UDP) route. Currently not supported.
1191+
ApisixRouteStream defines the configuration for a Layer 4 (TCP/UDP) route.
11911192

11921193

11931194

0 commit comments

Comments
 (0)