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

Child Resources having no owner references are created more than once #489

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OwnerRefs do not work across namespaces. However, skipping an owner reference doesn't mean I dont want children in the same namespace.

I think you should just set the list options you want in special cases.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, thanks!

}

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