Cleanup watch encoding (remove dupe Encoding)

Move standard watch encode / decode streams to use
runtime.RawExtension and embed API decoding based on
a provided codec.
This commit is contained in:
Clayton Coleman
2014-09-17 00:33:48 -04:00
parent 6778a8d88d
commit e3da2ba2c8
11 changed files with 239 additions and 145 deletions

View File

@@ -28,11 +28,11 @@ import (
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
cwatch "github.com/GoogleCloudPlatform/kubernetes/pkg/client/watch"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
watchjson "github.com/GoogleCloudPlatform/kubernetes/pkg/watch/json"
"github.com/golang/glog"
)
@@ -269,7 +269,7 @@ func (r *Request) Watch() (watch.Interface, error) {
if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Got status: %v", response.StatusCode)
}
return watch.NewStreamWatcher(cwatch.NewAPIEventDecoder(response.Body)), nil
return watch.NewStreamWatcher(watchjson.NewDecoder(response.Body, r.c.Codec)), nil
}
// Do formats and executes the request. Returns the API object received, or an error.