Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ func (s *Service) getBackendModel(store store.K8s, a annotations.Annotations, cl
// get/create backend Model
backend, err = annotations.ModelBackend("cr-backend", s.resource.Namespace, store, s.annotations...)
logger.Warning(err)
if backend != nil {
// Deep-copy the CR object before mutating it: multiple services may share the
// same cr-backend annotation and therefore the same *v3.BackendSpec pointer in
// the store. Without a copy, mutations below (BackendBase.Name, Servers map,
// etc.) bleed across services, causing one backend's server list to contaminate
// another's.
var backendCopy v3.BackendSpec
backend.DeepCopyInto(&backendCopy)
backend = &backendCopy
}
if backend == nil {
backend = &v3.BackendSpec{
Backend: models.Backend{
Expand Down
Loading