From 8a09d761986c49487b77c039a2faab45697d0928 Mon Sep 17 00:00:00 2001 From: cleverhu Date: Tue, 22 Nov 2022 20:17:06 +0800 Subject: [PATCH] fix request.operation in globalValues is always set to CREATE (#5423) Signed-off-by: cleverhu Co-authored-by: Vyankatesh Kudtarkar --- cmd/cli/kubectl-kyverno/utils/common/common.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/cli/kubectl-kyverno/utils/common/common.go b/cmd/cli/kubectl-kyverno/utils/common/common.go index 3eefcd2372..e147418f85 100644 --- a/cmd/cli/kubectl-kyverno/utils/common/common.go +++ b/cmd/cli/kubectl-kyverno/utils/common/common.go @@ -327,8 +327,11 @@ func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit } if globalValMap != nil { - globalValMap["request.operation"] = "CREATE" - log.Log.V(3).Info("Defaulting request.operation to CREATE") + _, exist := globalValMap["request.operation"] + if !exist { + globalValMap["request.operation"] = "CREATE" + log.Log.V(3).Info("Defaulting request.operation to CREATE") + } } storePolicies := make([]store.Policy, 0)