Change CreationTimestamp to a util.Time and set in each storage implementation

Because time.Time doesn't work correctly with our YAML package, it is necessary
to introduce a type, util.Time, which serializes correctly to JSON and YAML.

Eventually we would like timestamping to cut across storage implementations;
for now, we set it in each storage.
This commit is contained in:
Paul Morie
2014-08-12 15:14:00 -04:00
parent 9355fae71e
commit c69160059b
10 changed files with 262 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
// RegistryStorage implements the RESTStorage interface, backed by a MinionRegistry.
@@ -44,6 +45,9 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
if minion.ID == "" {
return nil, fmt.Errorf("ID should not be empty: %#v", minion)
}
minion.CreationTimestamp = util.Now()
return apiserver.MakeAsync(func() (interface{}, error) {
err := rs.registry.Insert(minion.ID)
if err != nil {