Skip to content

Commit 5866b12

Browse files
authored
Merge pull request #184 from tomasaschan/fix-source-as-owner
Skip setting owner refs for objects that don't support it
2 parents 6b14c87 + 23b0244 commit 5866b12

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/patterns/declarative/reconciler.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,12 @@ func (r *Reconciler) injectOwnerRef(ctx context.Context, instance DeclarativeObj
493493
continue
494494
}
495495

496-
// TODO, error/skip if:
497-
// - owner is namespaced and o is not
498-
// - owner is in a different namespace than o
496+
if owner.GetNamespace() != "" && owner.GetNamespace() != o.Namespace {
497+
// a namespaced object can only own objects within the same namespace, not objects in other namespaces or cluster-scoped objects
498+
// for any other combination, skip setting owner reference here, to allow declarative.SourceAsOwner to be used for the
499+
// subset of objects that make up a supported combination
500+
continue
501+
}
499502

500503
ownerRefs := []interface{}{
501504
map[string]interface{}{

0 commit comments

Comments
 (0)