diff --git a/controller/api/destination/watcher/endpoints_watcher.go b/controller/api/destination/watcher/endpoints_watcher.go index 361a40affb991..0e0faed589b97 100644 --- a/controller/api/destination/watcher/endpoints_watcher.go +++ b/controller/api/destination/watcher/endpoints_watcher.go @@ -563,6 +563,9 @@ func (sp *servicePublisher) metricsLabels(port Port, hostname string) prometheus } func (sp *servicePublisher) updateServer(server *v1beta1.Server, isAdd bool) { + sp.Lock() + defer sp.Unlock() + selector, err := metav1.LabelSelectorAsSelector(server.Spec.PodSelector) if err != nil { sp.log.Errorf("failed to create Selector: %s", err)