Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix Child Resources having no owner references are created more than …
Browse files Browse the repository at this point in the history
…once
  • Loading branch information
Siva Kommuri committed Mar 4, 2024
1 parent ae28210 commit 47cb73d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions reconcilers/child.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,12 @@ func (r *ChildReconciler[T, CT, CLT]) filterChildren(resource T, children CLT) [

func (r *ChildReconciler[T, CT, CLT]) listOptions(ctx context.Context, resource T) []client.ListOption {
if r.ListOptions == nil {
return []client.ListOption{
client.InNamespace(resource.GetNamespace()),
opts := []client.ListOption{}
if !r.SkipOwnerReference {
opts = append(opts, client.InNamespace(resource.GetNamespace()))
}

return opts
}
return r.ListOptions(ctx, resource)
}
Expand Down

0 comments on commit 47cb73d

Please sign in to comment.