From 18b69ef17d1ee191ad7a90ed4d927cbfa212d450 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 14 Sep 2021 17:54:37 -0400 Subject: [PATCH] Switch from json-iterator to utiljson Kubernetes-commit: bba877d3a6d0e6498d5e43a54939d5e4e8baee1a --- pkg/admission/plugin/webhook/mutating/dispatcher.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/admission/plugin/webhook/mutating/dispatcher.go b/pkg/admission/plugin/webhook/mutating/dispatcher.go index a419328f4..d73b220ec 100644 --- a/pkg/admission/plugin/webhook/mutating/dispatcher.go +++ b/pkg/admission/plugin/webhook/mutating/dispatcher.go @@ -34,6 +34,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer/json" + utiljson "k8s.io/apimachinery/pkg/util/json" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apiserver/pkg/admission" admissionmetrics "k8s.io/apiserver/pkg/admission/metrics" @@ -61,8 +62,6 @@ const ( MutationAuditAnnotationFailedOpenKeyPrefix string = "failed-open." + MutationAuditAnnotationPrefix ) -var encodingjson = json.CaseSensitiveJSONIterator() - type mutatingDispatcher struct { cm *webhookutil.ClientManager plugin *Plugin @@ -444,7 +443,7 @@ func mutationAnnotationValue(configuration, webhook string, mutated bool) (strin Webhook: webhook, Mutated: mutated, } - bytes, err := encodingjson.Marshal(m) + bytes, err := utiljson.Marshal(m) return string(bytes), err } @@ -455,6 +454,6 @@ func jsonPatchAnnotationValue(configuration, webhook string, patch interface{}) Patch: patch, PatchType: string(admissionv1.PatchTypeJSONPatch), } - bytes, err := encodingjson.Marshal(p) + bytes, err := utiljson.Marshal(p) return string(bytes), err }