From 5b4390328612f6aa5ca00947f7a2c782ad113270 Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Wed, 6 Dec 2023 09:40:04 +0000 Subject: [PATCH] Fixing reconcile due to failing integration test --- controllers/kuadrant_controller.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/controllers/kuadrant_controller.go b/controllers/kuadrant_controller.go index 3301f629a..14ba2dcef 100644 --- a/controllers/kuadrant_controller.go +++ b/controllers/kuadrant_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" "encoding/json" + "reflect" "github.com/kuadrant/kuadrant-operator/pkg/kuadranttools" corev1 "k8s.io/api/core/v1" @@ -497,6 +498,22 @@ func (r *KuadrantReconciler) reconcileLimitador(ctx context.Context, kObj *kuadr limitador.Spec.Storage = kObj.Spec.Limitador.Storage } } + + tmp := &limitadorv1alpha1.Limitador{ + ObjectMeta: metav1.ObjectMeta{ + Name: "temp", + Namespace: kObj.Namespace, + }, + } + err = r.SetOwnerReference(kObj, tmp) + if err != nil { + return err + } + + if limitador.OwnerReferences != nil && !reflect.DeepEqual(tmp.OwnerReferences, limitador.OwnerReferences) { + return nil + } + err = r.SetOwnerReference(kObj, limitador) if err != nil { return err