diff --git a/test/images/agnhost/webhook/configmap.go b/test/images/agnhost/webhook/configmap.go index 85fbb1db63f..3ccdf4e27e3 100644 --- a/test/images/agnhost/webhook/configmap.go +++ b/test/images/agnhost/webhook/configmap.go @@ -97,8 +97,10 @@ func mutateConfigmaps(ar v1.AdmissionReview) *v1.AdmissionResponse { reviewResponse.Patch = []byte(configMapPatch2) } - pt := v1.PatchTypeJSONPatch - reviewResponse.PatchType = &pt + if len(reviewResponse.Patch) != 0 { + pt := v1.PatchTypeJSONPatch + reviewResponse.PatchType = &pt + } return &reviewResponse } diff --git a/test/images/agnhost/webhook/customresource.go b/test/images/agnhost/webhook/customresource.go index a1452d6454e..50289e09915 100644 --- a/test/images/agnhost/webhook/customresource.go +++ b/test/images/agnhost/webhook/customresource.go @@ -56,8 +56,10 @@ func mutateCustomResource(ar v1.AdmissionReview) *v1.AdmissionResponse { if cr.Data["mutation-stage-1"] == "yes" { reviewResponse.Patch = []byte(customResourcePatch2) } - pt := v1.PatchTypeJSONPatch - reviewResponse.PatchType = &pt + if len(reviewResponse.Patch) != 0 { + pt := v1.PatchTypeJSONPatch + reviewResponse.PatchType = &pt + } return &reviewResponse }