mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 05:36:12 +00:00
#2049 DeepCopy Service instead of shallow copy
This commit is contained in:
@@ -75,7 +75,12 @@ func (r *ServiceRegistry) CreateService(ctx api.Context, svc *api.Service) (*api
|
||||
defer r.mu.Unlock()
|
||||
|
||||
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)
|
||||
return svc, r.Err
|
||||
}
|
||||
|
Reference in New Issue
Block a user