mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
fix: deep copy resource in cli when operation is update (#9191)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
e68bca6563
commit
3f865d2038
1 changed files with 2 additions and 1 deletions
|
@ -234,7 +234,8 @@ func (p *PolicyProcessor) makePolicyContext(
|
|||
return nil, fmt.Errorf("failed to create policy context (%w)", err)
|
||||
}
|
||||
if operation == kyvernov1.Update {
|
||||
policyContext = policyContext.WithOldResource(resource)
|
||||
resource := resource.DeepCopy()
|
||||
policyContext = policyContext.WithOldResource(*resource)
|
||||
if err := policyContext.JSONContext().AddOldResource(resource.Object); err != nil {
|
||||
return nil, fmt.Errorf("failed to update old resource in json context (%w)", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue