Decouple apiserver from codec implementation

The apiserver on initialization must be provided with a codec
for encoding and decoding all handled objects including api.Status
and api.ServerOp.  In addition, the RESTStorage Extract() method
has been changed to New(), which returns a pointer object that the
codec must decode into (the internal object).  Switched registry
methods to use pointers for Create/Update instead of values.
This commit is contained in:
Clayton Coleman
2014-08-05 23:10:48 -04:00
parent 4123a44653
commit c9fc0bcf3d
16 changed files with 140 additions and 128 deletions

View File

@@ -21,6 +21,7 @@ import (
"net/http"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
@@ -140,5 +141,5 @@ func (m *Master) Run(myAddress, apiPrefix string) error {
// Instead of calling Run, you can call this function to get a handler for your own server.
// It is intended for testing. Only call once.
func (m *Master) ConstructHandler(apiPrefix string) http.Handler {
return apiserver.New(m.storage, apiPrefix)
return apiserver.New(m.storage, api.Codec, apiPrefix)
}