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 27, 2024
1 parent f4e54c2 commit c57eacf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/agent/controller/endpoint_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

"github.com/pkg/errors"
"github.com/submariner-io/admiral/pkg/log"
"github.com/submariner-io/admiral/pkg/resource"
"github.com/submariner-io/admiral/pkg/slices"
"github.com/submariner-io/admiral/pkg/syncer"
"github.com/submariner-io/admiral/pkg/syncer/broker"
Expand Down Expand Up @@ -234,8 +235,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 +260,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 +287,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 c57eacf

Please sign in to comment.