Skip to content

Commit

Permalink
Add owner references to mutator function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Boomatang committed Jan 16, 2024
1 parent c1ca4ec commit ed429c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/kuadranttools/limitador_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Check warning on line 26 in pkg/kuadranttools/limitador_tools.go

View check run for this annotation

Codecov / codecov/patch

pkg/kuadranttools/limitador_tools.go#L24-L26

Added lines #L24 - L26 were not covered by tests

existingSpec := limitadorSpecSubSet(existing.Spec)
desiredSpec := limitadorSpecSubSet(desired.Spec)

Expand Down

0 comments on commit ed429c6

Please sign in to comment.