mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-20 02:28:20 +00:00
Use CodecFactory.WithoutConversion() everywhere
Clarifies that requesting no conversion is part of the codec factory, and future refactors will make the codec factory less opionated about conversion. Kubernetes-commit: 7f9dfe58f4cbe1e1b9e80f52addff70bac87bed4
This commit is contained in:
committed by
Kubernetes Publisher
parent
2e1a3ed22a
commit
3da8d3a9fe
@@ -32,7 +32,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
@@ -55,7 +54,7 @@ func TestSerializer(t *testing.T) {
|
||||
contentConfig := ContentConfig{
|
||||
ContentType: "application/json",
|
||||
GroupVersion: &gv,
|
||||
NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
|
||||
NegotiatedSerializer: scheme.Codecs.WithoutConversion(),
|
||||
}
|
||||
|
||||
serializer, err := createSerializers(contentConfig)
|
||||
@@ -334,7 +333,7 @@ func restClient(testServer *httptest.Server) (*RESTClient, error) {
|
||||
Host: testServer.URL,
|
||||
ContentConfig: ContentConfig{
|
||||
GroupVersion: &v1.SchemeGroupVersion,
|
||||
NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
|
||||
NegotiatedSerializer: scheme.Codecs.WithoutConversion(),
|
||||
},
|
||||
Username: "user",
|
||||
Password: "pass",
|
||||
|
@@ -43,7 +43,6 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/util/clock"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
@@ -283,7 +282,7 @@ func defaultContentConfig() ContentConfig {
|
||||
return ContentConfig{
|
||||
ContentType: "application/json",
|
||||
GroupVersion: &gvCopy,
|
||||
NegotiatedSerializer: serializer.DirectCodecFactory{CodecFactory: scheme.Codecs},
|
||||
NegotiatedSerializer: scheme.Codecs.WithoutConversion(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,6 @@ import (
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
runtimejson "k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -38,7 +37,7 @@ import (
|
||||
// getDecoder mimics how k8s.io/client-go/rest.createSerializers creates a decoder
|
||||
func getDecoder() runtime.Decoder {
|
||||
jsonSerializer := runtimejson.NewSerializer(runtimejson.DefaultMetaFactory, scheme.Scheme, scheme.Scheme, false)
|
||||
directCodecFactory := serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
directCodecFactory := scheme.Codecs.WithoutConversion()
|
||||
return directCodecFactory.DecoderToVersion(jsonSerializer, v1.SchemeGroupVersion)
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,6 @@ import (
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
runtimejson "k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
@@ -36,7 +35,7 @@ import (
|
||||
// getEncoder mimics how k8s.io/client-go/rest.createSerializers creates a encoder
|
||||
func getEncoder() runtime.Encoder {
|
||||
jsonSerializer := runtimejson.NewSerializer(runtimejson.DefaultMetaFactory, scheme.Scheme, scheme.Scheme, false)
|
||||
directCodecFactory := serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
directCodecFactory := scheme.Codecs.WithoutConversion()
|
||||
return directCodecFactory.EncoderForVersion(jsonSerializer, v1.SchemeGroupVersion)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user