diff --git a/go.mod b/go.mod index be39287..b6d3966 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ replace github.com/projectcontour/contour => github.com/snapp-incubator/contour require ( github.com/go-logr/logr v1.2.4 + github.com/json-iterator/go v1.1.12 github.com/labstack/echo/v4 v4.11.2 github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.28.0 @@ -56,7 +57,6 @@ require ( github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/labstack/gommon v0.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect diff --git a/internal/webhook/validate_test.go b/internal/webhook/validate_test.go index f6f9978..339b00e 100644 --- a/internal/webhook/validate_test.go +++ b/internal/webhook/validate_test.go @@ -2,7 +2,6 @@ package webhook import ( "bytes" - "encoding/json" "fmt" "net/http" "net/http/httptest" diff --git a/internal/webhook/webhook.go b/internal/webhook/webhook.go index 3b41805..aecdf00 100644 --- a/internal/webhook/webhook.go +++ b/internal/webhook/webhook.go @@ -1,13 +1,13 @@ package webhook import ( - "encoding/json" "fmt" "io" "net" "net/http" "time" + jsoniter "github.com/json-iterator/go" "github.com/labstack/echo/v4" contourv1 "github.com/projectcontour/contour/apis/projectcontour/v1" "github.com/snapp-incubator/contour-admission-webhook/internal/cache" @@ -26,6 +26,8 @@ var ( codecFactory = serializer.NewCodecFactory(scheme) deserializer = codecFactory.UniversalDeserializer() + json = jsoniter.ConfigCompatibleWithStandardLibrary + entryTtlSecond int logger = ctrl.Log.WithName("webhook")