Skip to content

Commit

Permalink
Backport of Bugfix: Don't recreate servicemap for catalog sync into r…
Browse files Browse the repository at this point in the history
…elease/1.2.x (#3789)

backport of commit 5208e7b

Co-authored-by: jukie <[email protected]>
  • Loading branch information
hc-github-team-consul-core and jukie authored Mar 20, 2024
1 parent 8f70c98 commit 2162ec5
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions control-plane/catalog/to-consul/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,22 +878,9 @@ func (t *serviceEndpointsResource) Upsert(endptKey string, raw interface{}) erro
svc.serviceLock.Lock()
defer svc.serviceLock.Unlock()

// Extract service name and format key
svcName := endpointSlice.Labels[discoveryv1.LabelServiceName]
// Extract service name and format the service key
svcKey := endpointSlice.Namespace + "/" + endpointSlice.Labels[discoveryv1.LabelServiceName]

if svc.serviceMap == nil {
svc.serviceMap = make(map[string]*corev1.Service)
}
var err error
if svc.serviceMap[svcKey] == nil {
svc.serviceMap[svcKey], err = t.Service.Client.CoreV1().Services(endpointSlice.Namespace).Get(t.Ctx, svcName, metav1.GetOptions{})
if err != nil {
t.Log.Error("issue getting service", "error", err)
return err
}
}

// Check if we care about endpoints for this service
if !svc.shouldTrackEndpoints(svcKey) {
return nil
Expand Down

0 comments on commit 2162ec5

Please sign in to comment.