From ed429c6acbb2c0f814971200c957ee88c7ebf9f1 Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Tue, 16 Jan 2024 12:00:13 +0000 Subject: [PATCH] Add owner references to mutator function Fixes edge case. The user is using limitador as a standalone product before using kuadrant and has the limitador CR called `limitador`. Once kuadrant is installed to the same namespace the kuadrant operator should take ownership of the limitador CR. The update in this commit is only required for this use case. --- pkg/kuadranttools/limitador_tools.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/kuadranttools/limitador_tools.go b/pkg/kuadranttools/limitador_tools.go index ddba5da11..4710cc2ec 100644 --- a/pkg/kuadranttools/limitador_tools.go +++ b/pkg/kuadranttools/limitador_tools.go @@ -20,6 +20,11 @@ func LimitadorMutator(existingObj, desiredObj client.Object) (bool, error) { return false, fmt.Errorf("desireObj %T is not a *limitadorv1alpha1.Limitador", desiredObj) } + if !reflect.DeepEqual(existing.OwnerReferences, desired.OwnerReferences) { + update = true + existing.OwnerReferences = desired.OwnerReferences + } + existingSpec := limitadorSpecSubSet(existing.Spec) desiredSpec := limitadorSpecSubSet(desired.Spec)