#2049 DeepCopy Service instead of shallow copy

This commit is contained in:
Sylwester Brzeczkowski
2016-05-30 14:53:09 +02:00
parent e531a7784e
commit af0f053cdf

View File

@@ -75,7 +75,12 @@ func (r *ServiceRegistry) CreateService(ctx api.Context, svc *api.Service) (*api
defer r.mu.Unlock() defer r.mu.Unlock()
r.Service = new(api.Service) r.Service = new(api.Service)
*r.Service = *svc clone, err := api.Scheme.DeepCopy(svc)
if err != nil {
return nil, err
}
r.Service = clone.(*api.Service)
r.List.Items = append(r.List.Items, *svc) r.List.Items = append(r.List.Items, *svc)
return svc, r.Err return svc, r.Err
} }