Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Don't recreate servicemap for catalog sync #3785

Merged
merged 2 commits into from
Mar 20, 2024
Merged
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
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
Loading