Skip to content

Commit 0a48752

Browse files
committed
fix: ApisixRoute controller watch annotation change
Signed-off-by: ashing <axingfly@gmail.com>
1 parent bab818f commit 0a48752

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

internal/controller/apisixroute_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ func (r *ApisixRouteReconciler) SetupWithManager(mgr ctrl.Manager) error {
6363
WithEventFilter(
6464
predicate.Or(
6565
predicate.GenerationChangedPredicate{},
66+
predicate.AnnotationChangedPredicate{},
6667
predicate.NewPredicateFuncs(func(obj client.Object) bool {
6768
_, ok := obj.(*corev1.Secret)
6869
return ok
6970
}),
7071
),
7172
).
72-
Watches(&networkingv1.IngressClass{},
73+
Watches(
74+
&networkingv1.IngressClass{},
7375
handler.EnqueueRequestsFromMapFunc(r.listApisixRouteForIngressClass),
7476
builder.WithPredicates(
7577
predicate.NewPredicateFuncs(matchesIngressController),
File renamed without changes.

internal/controller/gatewayproxy_controller.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
ctrl "sigs.k8s.io/controller-runtime"
3131
"sigs.k8s.io/controller-runtime/pkg/client"
3232
"sigs.k8s.io/controller-runtime/pkg/handler"
33+
"sigs.k8s.io/controller-runtime/pkg/predicate"
3334
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3435
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
3536

@@ -51,6 +52,15 @@ type GatewayProxyController struct {
5152
func (r *GatewayProxyController) SetupWithManager(mrg ctrl.Manager) error {
5253
return ctrl.NewControllerManagedBy(mrg).
5354
For(&v1alpha1.GatewayProxy{}).
55+
WithEventFilter(
56+
predicate.Or(
57+
predicate.GenerationChangedPredicate{},
58+
predicate.NewPredicateFuncs(func(obj client.Object) bool {
59+
_, ok := obj.(*corev1.Secret)
60+
return ok
61+
}),
62+
),
63+
).
5464
Watches(&corev1.Service{},
5565
handler.EnqueueRequestsFromMapFunc(r.listGatewayProxiesForProviderService),
5666
).

internal/controller/ingressclass_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func (r *IngressClassReconciler) SetupWithManager(mgr ctrl.Manager) error {
6262
WithEventFilter(
6363
predicate.Or(
6464
predicate.GenerationChangedPredicate{},
65+
predicate.AnnotationChangedPredicate{},
6566
predicate.NewPredicateFuncs(func(obj client.Object) bool {
6667
_, ok := obj.(*corev1.Secret)
6768
return ok

0 commit comments

Comments
 (0)