Skip to content

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 ca011c2 commit 35b7cd3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions reconcilers/child.go
Expand Up @@ -363,9 +363,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 35b7cd3

Please sign in to comment.