mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
remove ownerReferences when cloning resources to other namespace.
Signed-off-by: Matthias Frey <matthias.frey@kit.edu>
This commit is contained in:
parent
c522343c03
commit
605110d4ca
1 changed files with 4 additions and 0 deletions
|
@ -422,6 +422,10 @@ func manageClone(log logr.Logger, apiVersion, kind, namespace, name, policy stri
|
|||
if err != nil {
|
||||
return nil, Skip, fmt.Errorf("source resource %s %s/%s/%s not found. %v", apiVersion, kind, rNamespace, rName, err)
|
||||
}
|
||||
// remove ownerReferences when cloning resources to other namespace
|
||||
if rNamespace != namespace && obj.GetOwnerReferences() != nil {
|
||||
obj.SetOwnerReferences(nil)
|
||||
}
|
||||
|
||||
// check if resource to be generated exists
|
||||
newResource, err := client.GetResource(apiVersion, kind, namespace, name)
|
||||
|
|
Loading…
Reference in a new issue