mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47: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:
@@ -17,7 +17,12 @@ limitations under the License.
|
||||
package latest
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/plugin/pkg/scheduler/api/v1"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/runtime/serializer/json"
|
||||
"k8s.io/kubernetes/pkg/runtime/serializer/versioning"
|
||||
"k8s.io/kubernetes/plugin/pkg/scheduler/api"
|
||||
_ "k8s.io/kubernetes/plugin/pkg/scheduler/api/v1"
|
||||
)
|
||||
|
||||
// Version is the string that represents the current external default version.
|
||||
@@ -33,6 +38,10 @@ const OldestVersion = "v1"
|
||||
var Versions = []string{"v1"}
|
||||
|
||||
// Codec is the default codec for serializing input that should use
|
||||
// the latest supported version.
|
||||
// This codec can decode any object that Kubernetes is aware of.
|
||||
var Codec = v1.Codec
|
||||
// the latest supported version. It supports JSON by default.
|
||||
var Codec = versioning.NewCodecForScheme(
|
||||
api.Scheme,
|
||||
json.NewSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme), true),
|
||||
[]unversioned.GroupVersion{{Version: Version}},
|
||||
[]unversioned.GroupVersion{{Version: runtime.APIVersionInternal}},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user