#2049 DeepCopy Service instead of shallow copy

parent e531a778
...@@ -75,7 +75,12 @@ func (r *ServiceRegistry) CreateService(ctx api.Context, svc *api.Service) (*api ...@@ -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
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment