Combine pkg/apitools and pkg/api/common and call the result pkg/runtime

This commit is contained in:
Daniel Smith
2014-09-02 10:55:27 -07:00
parent 099c8fd36f
commit a63966e73c
44 changed files with 218 additions and 237 deletions

View File

@@ -31,8 +31,8 @@ import (
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apitools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
)
@@ -41,11 +41,11 @@ func convert(obj interface{}) (interface{}, error) {
return obj, nil
}
var codec = apitools.Codec
var codec = runtime.Codec
func init() {
apitools.AddKnownTypes("", Simple{}, SimpleList{})
apitools.AddKnownTypes("v1beta1", Simple{}, SimpleList{})
runtime.AddKnownTypes("", Simple{}, SimpleList{})
runtime.AddKnownTypes("v1beta1", Simple{}, SimpleList{})
}
type Simple struct {
@@ -697,7 +697,7 @@ func TestWriteJSONDecodeError(t *testing.T) {
type T struct {
Value string
}
writeJSON(http.StatusOK, apitools.Codec, &T{"Undecodable"}, w)
writeJSON(http.StatusOK, runtime.Codec, &T{"Undecodable"}, w)
}))
status := expectApiStatus(t, "GET", server.URL, nil, http.StatusInternalServerError)
if status.Reason != api.StatusReasonUnknown {

View File

@@ -24,9 +24,9 @@ import (
"code.google.com/p/go.net/websocket"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/common"
"github.com/GoogleCloudPlatform/kubernetes/pkg/httplog"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
)
@@ -113,7 +113,7 @@ func (w *WatchServer) HandleWS(ws *websocket.Conn) {
}
err := websocket.JSON.Send(ws, &api.WatchEvent{
Type: event.Type,
Object: common.Object{event.Object},
Object: runtime.Object{event.Object},
})
if err != nil {
// Client disconnect.
@@ -160,7 +160,7 @@ func (self *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
err := encoder.Encode(&api.WatchEvent{
Type: event.Type,
Object: common.Object{event.Object},
Object: runtime.Object{event.Object},
})
if err != nil {
// Client disconnect.