mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Switch API objects to not register per version codecs
Remove Codec from versionInterfaces in meta (RESTMapper is now agnostic to codec and serialization). Register api/latest.Codecs as the codec factory and use latest.Codecs.LegacyCodec(version) as an equvialent to the previous codec.
This commit is contained in:
@@ -28,12 +28,13 @@ import (
|
||||
)
|
||||
|
||||
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
||||
data, err := versioned.Codec.Encode(obj)
|
||||
codec := api.Codecs.LegacyCodec(versioned.SchemeGroupVersion)
|
||||
data, err := runtime.Encode(codec, obj)
|
||||
if err != nil {
|
||||
t.Errorf("%v\n %#v", err, obj)
|
||||
return nil
|
||||
}
|
||||
obj2, err := api.Codec.Decode(data)
|
||||
obj2, err := runtime.Decode(codec, data)
|
||||
if err != nil {
|
||||
t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user