Skip to content

Commit 1ab93fc

Browse files
committed
Merge branch 'master' into feat/benchmark-test
2 parents 8dc9191 + 2bab77a commit 1ab93fc

20 files changed

+554
-100
lines changed

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/concepts/gateway-api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ The fields below are specified in the Gateway API specification but are either p
7979
| Fields | Status | Notes |
8080
|------------------------------------------------------|----------------------|------------------------------------------------------------------------------------------------|
8181
| `spec.listeners[].port` | Not supported* | The configuration is required but ignored. This is due to limitations in the data plane: it cannot dynamically open new ports. Since the Ingress Controller does not manage the data plane deployment, it cannot automatically update the configuration or restart the data plane to apply port changes. |
82-
| `spec.listeners[].allowedRoutes.kinds` | Partially supported | Only `HTTPRoute` (group `gateway.networking.k8s.io`) is accepted; other kinds are rejected. |
8382
| `spec.listeners[].tls.certificateRefs[].group` | Partially supported | Only `""` is supported; other group values cause validation failure. |
8483
| `spec.listeners[].tls.certificateRefs[].kind` | Partially supported | Only `Secret` is supported. |
8584
| `spec.listeners[].tls.mode` | Partially supported | `Terminate` is implemented; `Passthrough` is effectively unsupported for Gateway listeners. |

internal/controller/gateway_controller.go

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"context"
2222
"errors"
2323
"fmt"
24-
"reflect"
2524

2625
"github.com/go-logr/logr"
2726
corev1 "k8s.io/api/core/v1"
@@ -35,6 +34,7 @@ import (
3534
"sigs.k8s.io/controller-runtime/pkg/predicate"
3635
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3736
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
37+
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
3838
"sigs.k8s.io/gateway-api/apis/v1beta1"
3939

4040
"github.com/apache/apisix-ingress-controller/api/v1alpha1"
@@ -62,13 +62,10 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
6262
For(
6363
&gatewayv1.Gateway{},
6464
builder.WithPredicates(
65-
predicate.NewPredicateFuncs(r.checkGatewayClass),
66-
),
67-
).
68-
WithEventFilter(
69-
predicate.Or(
70-
predicate.GenerationChangedPredicate{},
71-
predicate.NewPredicateFuncs(TypePredicate[*corev1.Secret]()),
65+
predicate.And(
66+
predicate.NewPredicateFuncs(r.checkGatewayClass),
67+
predicate.GenerationChangedPredicate{},
68+
),
7269
),
7370
).
7471
Watches(
@@ -80,7 +77,23 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
8077
).
8178
Watches(
8279
&gatewayv1.HTTPRoute{},
83-
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForHTTPRoute),
80+
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForStatusParentRefs),
81+
).
82+
Watches(
83+
&gatewayv1.GRPCRoute{},
84+
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForStatusParentRefs),
85+
).
86+
Watches(
87+
&gatewayv1alpha2.TCPRoute{},
88+
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForStatusParentRefs),
89+
).
90+
Watches(
91+
&gatewayv1alpha2.TLSRoute{},
92+
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForStatusParentRefs),
93+
).
94+
Watches(
95+
&gatewayv1alpha2.UDPRoute{},
96+
handler.EnqueueRequestsFromMapFunc(r.listGatewaysForStatusParentRefs),
8497
).
8598
Watches(
8699
&v1alpha1.GatewayProxy{},
@@ -300,19 +313,11 @@ func (r *GatewayReconciler) listGatewaysForGatewayProxy(ctx context.Context, obj
300313
return recs
301314
}
302315

303-
func (r *GatewayReconciler) listGatewaysForHTTPRoute(ctx context.Context, obj client.Object) []reconcile.Request {
304-
httpRoute, ok := obj.(*gatewayv1.HTTPRoute)
305-
if !ok {
306-
r.Log.Error(
307-
fmt.Errorf("unexpected object type"),
308-
"HTTPRoute watch predicate received unexpected object type",
309-
"expected", "*gatewayapi.HTTPRoute", "found", reflect.TypeOf(obj),
310-
)
311-
return nil
312-
}
313-
recs := []reconcile.Request{}
314-
for _, routeParentStatus := range httpRoute.Status.Parents {
315-
gatewayNamespace := httpRoute.GetNamespace()
316+
func (r *GatewayReconciler) listGatewaysForStatusParentRefs(ctx context.Context, obj client.Object) []reconcile.Request {
317+
route := internaltypes.NewRouteAdapter(obj)
318+
reqs := []reconcile.Request{}
319+
for _, routeParentStatus := range route.GetParentStatuses() {
320+
gatewayNamespace := route.GetNamespace()
316321
parentRef := routeParentStatus.ParentRef
317322
if parentRef.Group != nil && *parentRef.Group != gatewayv1.GroupName {
318323
continue
@@ -336,14 +341,14 @@ func (r *GatewayReconciler) listGatewaysForHTTPRoute(ctx context.Context, obj cl
336341
continue
337342
}
338343

339-
recs = append(recs, reconcile.Request{
344+
reqs = append(reqs, reconcile.Request{
340345
NamespacedName: client.ObjectKey{
341346
Namespace: gatewayNamespace,
342347
Name: string(parentRef.Name),
343348
},
344349
})
345350
}
346-
return recs
351+
return reqs
347352
}
348353

349354
func (r *GatewayReconciler) listGatewaysForSecret(ctx context.Context, obj client.Object) (requests []reconcile.Request) {

0 commit comments

Comments
 (0)