From 5e0b20fcd67109bb83394dd307bcc8211acd7dbf Mon Sep 17 00:00:00 2001 From: Gaurav Singh Date: Thu, 25 Jun 2020 12:08:52 -0400 Subject: [PATCH] [apimachinery] Remove map nil check before delete in mergeMap Signed-off-by: Gaurav Singh --- .../src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index c55894e5023..600f3befd2e 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -1321,9 +1321,7 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me // Preserving the null value is useful when we want to send an explicit // delete to the API server. if patchV == nil { - if _, ok := original[k]; ok { - delete(original, k) - } + delete(original, k) if mergeOptions.IgnoreUnmatchedNulls { continue }