Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Aug 15, 2023
1 parent 7117f75 commit 9be6686
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions multicluster/service-mirror/cluster_watcher.go
Expand Up @@ -895,7 +895,7 @@ func (rcsw *RemoteClusterServiceWatcher) Start(ctx context.Context) error {
return
}
if rcsw.isRemoteDiscovery(epNew.Labels) {
rcsw.log.Debugf("skipped processing endpoints object %s/%s (not mirrored in remote-discovery mode)", epNew.Namespace, epNew.Name)
rcsw.log.Debugf("skipped processing endpoints object %s/%s (service labeled for remote-discovery mode)", epNew.Namespace, epNew.Name)
return
}
rcsw.eventsQueue.Add(&OnUpdateEndpointsCalled{epNew})
Expand Down Expand Up @@ -1025,7 +1025,7 @@ func (rcsw *RemoteClusterServiceWatcher) repairEndpoints(ctx context.Context) er
continue
}

if rcsw.isRemoteDiscovery(svc.Labels) {
if _, ok := svc.Labels[consts.RemoteDiscoveryLabel]; ok {
rcsw.log.Debugf("Skipped repairing endpoints for service in remote-discovery mode %s/%s", svc.Namespace, svc.Name)
continue
}
Expand Down Expand Up @@ -1241,14 +1241,7 @@ func (rcsw *RemoteClusterServiceWatcher) isExported(l map[string]string) bool {
return selector.Matches(labels.Set(l)) || remoteDiscoverySelector.Matches(labels.Set(l))
}

// isRemoteDiscovery returns true if the passed labels correspond to a local
// mirror Service or a remote Service/Endpoints in remote-discovery mode
func (rcsw *RemoteClusterServiceWatcher) isRemoteDiscovery(l map[string]string) bool {
_, ok := l[consts.RemoteDiscoveryLabel]
if ok {
return true
}

// Treat an empty remoteDiscoverySelector as "Nothing" instead of
// "Everything" so that when the remoteDiscoverySelector field is unset, we
// don't export all Services.
Expand Down

0 comments on commit 9be6686

Please sign in to comment.