Merge pull request #125186 from liyuerich/newserializer

drop deprecated json/yaml newSerializers, use json.NewSerializerWithO…

Kubernetes-commit: e5dd48efd07e8a052604b3073e0fafe7361ca689
This commit is contained in:
Kubernetes Publisher 2024-09-13 15:39:12 +01:00
commit ac5c364aba
4 changed files with 8 additions and 8 deletions

4
go.mod
View File

@ -50,8 +50,8 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/square/go-jose.v2 v2.6.0
k8s.io/api v0.0.0-20240912033524-9dc1a952bda9
k8s.io/apimachinery v0.0.0-20240912084119-b78556fffe6e
k8s.io/client-go v0.0.0-20240912113359-53c7e93bf282
k8s.io/apimachinery v0.0.0-20240913152823-0fc0110cc2ce
k8s.io/client-go v0.0.0-20240913153400-fb6ca040d7b7
k8s.io/component-base v0.0.0-20240912040419-b642e81b6901
k8s.io/klog/v2 v2.130.1
k8s.io/kms v0.0.0-20240912041232-273c893e4e51

8
go.sum
View File

@ -373,10 +373,10 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20240912033524-9dc1a952bda9 h1:6xBz7kFYDoVtAQtP3Gga8zbnFwKkmmEoZ/pHeSI3Syk=
k8s.io/api v0.0.0-20240912033524-9dc1a952bda9/go.mod h1:kqx7iFMH/90/AevRsNf4J/UEHQ++Z4uR4xCFo8h2N1g=
k8s.io/apimachinery v0.0.0-20240912084119-b78556fffe6e h1:ojOmvlvjMxxsMsG4rCvIypPm8Xq2aUnE+dmaqTpEgcg=
k8s.io/apimachinery v0.0.0-20240912084119-b78556fffe6e/go.mod h1:5rKPDwwN9qm//xASFCZ83nyYEanHxxhc7pZ8AC4lukY=
k8s.io/client-go v0.0.0-20240912113359-53c7e93bf282 h1:FLQ0nr7YvcrUVmTkK2dijm4+gkqyy/FdVUlutN/nF9c=
k8s.io/client-go v0.0.0-20240912113359-53c7e93bf282/go.mod h1:KPItl6AYJhl/BFVVlTmv2/it0i1mW0hBimiqIXsjftw=
k8s.io/apimachinery v0.0.0-20240913152823-0fc0110cc2ce h1:/8pGA195j4uJHrstvUPo9YadPG7L/QHZ8pWOsUsnYUE=
k8s.io/apimachinery v0.0.0-20240913152823-0fc0110cc2ce/go.mod h1:5rKPDwwN9qm//xASFCZ83nyYEanHxxhc7pZ8AC4lukY=
k8s.io/client-go v0.0.0-20240913153400-fb6ca040d7b7 h1:hqQc6gQJB/OFFxuO+uDVaRNNHTBvMoPZf3UG9RW+YHg=
k8s.io/client-go v0.0.0-20240913153400-fb6ca040d7b7/go.mod h1:SHqrcQOS6L0CtlGn8DlOEAVxhSHlLqbNwD15CEqWSKU=
k8s.io/component-base v0.0.0-20240912040419-b642e81b6901 h1:fVwG5YBJ1UHiVeUPTfb6xuHJxdkHGTsFNKeY+3PoKVA=
k8s.io/component-base v0.0.0-20240912040419-b642e81b6901/go.mod h1:XuyW4XwRoBr6hyjKSLpKjJiTyTN3CrcU2wtI1I7h2JU=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=

View File

@ -348,7 +348,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss
}
var patchedJS []byte
jsonSerializer := json.NewSerializer(json.DefaultMetaFactory, o.GetObjectCreater(), o.GetObjectTyper(), false)
jsonSerializer := json.NewSerializerWithOptions(json.DefaultMetaFactory, o.GetObjectCreater(), o.GetObjectTyper(), json.SerializerOptions{})
switch result.PatchType {
// VerifyAdmissionResponse normalizes to v1 patch types, regardless of the AdmissionReview version used
case admissionv1.PatchTypeJSONPatch:

View File

@ -45,7 +45,7 @@ import (
// request body. The caller passes a callback which is called on each webhook POST.
// The object passed to cb is of the same type as list.
func newWebhookHandler(t *testing.T, list runtime.Object, cb func(events runtime.Object)) http.Handler {
s := json.NewSerializer(json.DefaultMetaFactory, audit.Scheme, audit.Scheme, false)
s := json.NewSerializerWithOptions(json.DefaultMetaFactory, audit.Scheme, audit.Scheme, json.SerializerOptions{})
return &testWebhookHandler{
t: t,
list: list,