mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Merge pull request #26529 from gitfred/deep-copy-svc
Automatic merge from submit-queue DeepCopy Service instead of shallow copy #2049 fixes #2049
This commit is contained in:
commit
dbaf18026f
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user