From dc4bd7d4fd2d62fa03d581882291dd034a08b6ef Mon Sep 17 00:00:00 2001 From: Danil Grigorev Date: Mon, 11 Dec 2023 14:01:03 +0100 Subject: [PATCH] Fix applied manifests ownership reference set - Prevent applied manifes from duplicating owner references from the provider object. --- internal/controller/component_customizer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/controller/component_customizer.go b/internal/controller/component_customizer.go index 30be7d6fc..7923967ca 100644 --- a/internal/controller/component_customizer.go +++ b/internal/controller/component_customizer.go @@ -58,7 +58,12 @@ func customizeObjectsFn(provider genericprovider.GenericProvider) func(objs []un if o.GetNamespace() != "" { // only set the ownership on namespaced objects. - o.SetOwnerReferences(util.EnsureOwnerRef(provider.GetOwnerReferences(), + ownerReferences := o.GetOwnerReferences() + if ownerReferences == nil { + ownerReferences = []metav1.OwnerReference{} + } + + o.SetOwnerReferences(util.EnsureOwnerRef(ownerReferences, metav1.OwnerReference{ APIVersion: operatorv1.GroupVersion.String(), Kind: provider.GetObjectKind().GroupVersionKind().Kind,