From 7374e2cf6a0b3c73fc0e606c8368fbc7d63d333e Mon Sep 17 00:00:00 2001 From: Dmitri Gekhtman <62982571+DmitriGekhtman@users.noreply.github.com> Date: Thu, 8 Dec 2022 19:03:09 -0800 Subject: [PATCH] [RayService] Skip update events without change (#811) (#825) Skip RayService reconcile when there is no config/label/annotation change Signed-off-by: Sihan Wang --- ray-operator/controllers/ray/rayservice_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ray-operator/controllers/ray/rayservice_controller.go b/ray-operator/controllers/ray/rayservice_controller.go index 9fcf8e9423..0f64945d38 100644 --- a/ray-operator/controllers/ray/rayservice_controller.go +++ b/ray-operator/controllers/ray/rayservice_controller.go @@ -22,6 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/predicate" "github.com/ray-project/kuberay/ray-operator/controllers/ray/utils" @@ -219,6 +220,7 @@ func (r *RayServiceReconciler) Reconcile(ctx context.Context, request ctrl.Reque func (r *RayServiceReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&rayv1alpha1.RayService{}). + WithEventFilter(predicate.Or(predicate.GenerationChangedPredicate{}, predicate.LabelChangedPredicate{}, predicate.AnnotationChangedPredicate{})). Owns(&rayv1alpha1.RayCluster{}). Owns(&corev1.Service{}). Owns(&networkingv1.Ingress{}).