mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
Make runtime less global for Codec
* Make Codec separate from Scheme * Move EncodeOrDie off Scheme to take a Codec * Make Copy work without a Codec * Create a "latest" package that imports all versions and sets global defaults for "most recent encoding" * v1beta1 is the current "latest", v1beta2 exists * Kill DefaultCodec, replace it with "latest.Codec" * This updates the client and etcd to store the latest known version * EmbeddedObject is per schema and per package now * Move runtime.DefaultScheme to api.Scheme * Split out WatchEvent since it's not an API object today, treat it like a special object in api * Kill DefaultResourceVersioner, instead place it on "latest" (as the package that understands all packages) * Move objDiff to runtime.ObjectDiff
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/cache"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
@@ -113,7 +114,7 @@ func TestPollMinions(t *testing.T) {
|
||||
ml := &api.MinionList{Items: item.minions}
|
||||
handler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: latest.Codec.EncodeOrDie(ml),
|
||||
ResponseBody: runtime.EncodeOrDie(latest.Codec, ml),
|
||||
T: t,
|
||||
}
|
||||
mux := http.NewServeMux()
|
||||
@@ -140,7 +141,7 @@ func TestDefaultErrorFunc(t *testing.T) {
|
||||
testPod := &api.Pod{JSONBase: api.JSONBase{ID: "foo"}}
|
||||
handler := util.FakeHandler{
|
||||
StatusCode: 200,
|
||||
ResponseBody: latest.Codec.EncodeOrDie(testPod),
|
||||
ResponseBody: runtime.EncodeOrDie(latest.Codec, testPod),
|
||||
T: t,
|
||||
}
|
||||
mux := http.NewServeMux()
|
||||
@@ -259,7 +260,7 @@ func TestBind(t *testing.T) {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
continue
|
||||
}
|
||||
expectedBody := latest.Codec.EncodeOrDie(item.binding)
|
||||
expectedBody := runtime.EncodeOrDie(latest.Codec, item.binding)
|
||||
handler.ValidateRequest(t, "/api/v1beta1/bindings", "POST", &expectedBody)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user