From 8c1369d5e4232146352b856c2c8010d5c41ea1bf Mon Sep 17 00:00:00 2001 From: Gaurav Singh Date: Wed, 22 Apr 2020 00:15:38 -0400 Subject: [PATCH] [apimachinery] map delete key remove exists check --- .../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 }