mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #1010 from smarterclayton/set_creation_time_on_services
Set creation timestamp on services
This commit is contained in:
commit
8c77124a4a
@ -50,6 +50,9 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
|
||||
if errs := api.ValidateService(srv); len(errs) > 0 {
|
||||
return nil, fmt.Errorf("Validation errors: %v", errs)
|
||||
}
|
||||
|
||||
srv.CreationTimestamp = util.Now()
|
||||
|
||||
return apiserver.MakeAsync(func() (interface{}, error) {
|
||||
// TODO: Consider moving this to a rectification loop, so that we make/remove external load balancers
|
||||
// correctly no matter what http operations happen.
|
||||
@ -78,7 +81,6 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
// TODO actually wait for the object to be fully created here.
|
||||
err := rs.registry.CreateService(*srv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -43,6 +43,9 @@ func TestServiceRegistryCreate(t *testing.T) {
|
||||
if created_service.ID != "foo" {
|
||||
t.Errorf("Expected foo, but got %v", created_service.ID)
|
||||
}
|
||||
if created_service.CreationTimestamp.IsZero() {
|
||||
t.Errorf("Expected timestamp to be set, got %:v", created_service.CreationTimestamp)
|
||||
}
|
||||
if len(fakeCloud.Calls) != 0 {
|
||||
t.Errorf("Unexpected call(s): %#v", fakeCloud.Calls)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user