Skip to content

Commit

Permalink
DO NOT MERGE - debug
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Sep 30, 2024
1 parent 3c37a47 commit a856d89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/agent/controller/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ func New(spec *AgentSpecification, syncerConf broker.SyncerConfig, agentConfig A
agentController.endpointSliceController, err = newEndpointSliceController(spec, syncerConf, agentController.serviceExportClient,
agentController.serviceSyncer, func(serviceName string, serviceNamespace string) *mcsv1a1.ServiceImport {
obj, found, _ := agentController.serviceImportController.remoteSyncer.GetResource(
brokerAggregatedServiceImportName(serviceName, serviceNamespace), syncerConf.BrokerNamespace)
brokerAggregatedServiceImportName(serviceName, serviceNamespace),
agentController.endpointSliceController.syncer.GetBrokerNamespace())
if !found {
return nil
}
Expand Down
13 changes: 12 additions & 1 deletion pkg/agent/controller/endpoint_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,11 @@ func (c *EndpointSliceController) hasNoRemainingEndpointSlices(endpointSlice *di
func (c *EndpointSliceController) checkForConflicts(_, name, namespace string) (bool, error) {
ctx := context.TODO()

logger.Infof("**********Checking conflicts for %s/%s", namespace, name)

localServiceExport := c.serviceExportClient.getLocalInstance(name, namespace)
if localServiceExport == nil {
logger.Infof("**********localServiceExport NOT FOUND for %s/%s", namespace, name)
return false, nil
}

Expand All @@ -256,17 +259,24 @@ func (c *EndpointSliceController) checkForConflicts(_, name, namespace string) (
for _, o := range epsList {
eps := o.(*discovery.EndpointSlice)

eps.SetManagedFields(nil)
//logger.Infof("**********Checking EPS %s", resource.ToJSON(eps))

if clusterNames.Has(eps.Labels[constants.MCSLabelSourceCluster]) {
logger.Infof("**********Skipping EPS %s/%s", namespace, name)
continue
}

clusterNames.Insert(eps.Labels[constants.MCSLabelSourceCluster])

//logger.Infof("**********Current prevServicePorts %s", resource.ToJSON(prevServicePorts))

servicePorts := c.serviceExportClient.toServicePorts(eps.Ports)
if prevServicePorts == nil {
prevServicePorts = servicePorts
intersectedServicePorts = servicePorts
} else if !slices.Equivalent(prevServicePorts, servicePorts, servicePortKey) {
logger.Info("**********CONFLICT!!!!!")
conflict = true
}

Expand All @@ -276,7 +286,8 @@ func (c *EndpointSliceController) checkForConflicts(_, name, namespace string) (
if conflict {
aggregatedSI := c.aggregatedServiceImportGetter(name, namespace)
if aggregatedSI == nil {
return false, nil
logger.Infof("**********aggregatedSI NOT FOUND for %s/%s", namespace, name)
return true, nil
}

exposedOp := "intersection"
Expand Down

0 comments on commit a856d89

Please sign in to comment.