From 07d758265a26e2d53dfc6722d39ef002f2767b31 Mon Sep 17 00:00:00 2001 From: Ammar Yasser Date: Wed, 20 Nov 2024 17:51:36 +0200 Subject: [PATCH] fix: Open the mutated resources file in append mode to allow additions to it (#11619) Signed-off-by: ammar Co-authored-by: ammar --- cmd/cli/kubectl-kyverno/processor/policy_processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cli/kubectl-kyverno/processor/policy_processor.go b/cmd/cli/kubectl-kyverno/processor/policy_processor.go index 98e4f6a289..a604c2d686 100644 --- a/cmd/cli/kubectl-kyverno/processor/policy_processor.go +++ b/cmd/cli/kubectl-kyverno/processor/policy_processor.go @@ -381,7 +381,7 @@ func (p *PolicyProcessor) printMutatedOutput(yaml string) error { } file = f } else { - f, err := os.OpenFile(filepath.Join(mutateLogPath, filename+".yaml"), os.O_CREATE|os.O_WRONLY, 0o600) // #nosec G304 + f, err := os.OpenFile(filepath.Join(mutateLogPath, filename+".yaml"), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600) // #nosec G304 if err != nil { return err }