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 e809a51
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions pkg/agent/controller/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/submariner-io/admiral/pkg/federate"
"github.com/submariner-io/admiral/pkg/ipam"
"github.com/submariner-io/admiral/pkg/log"
"github.com/submariner-io/admiral/pkg/resource"
"github.com/submariner-io/admiral/pkg/syncer"
"github.com/submariner-io/admiral/pkg/syncer/broker"
"github.com/submariner-io/lighthouse/pkg/constants"
Expand Down Expand Up @@ -126,6 +127,14 @@ func New(spec *AgentSpecification, syncerConf broker.SyncerConfig, agentConfig A
obj, found, _ := agentController.serviceImportController.remoteSyncer.GetResource(
brokerAggregatedServiceImportName(serviceName, serviceNamespace), syncerConf.BrokerNamespace)
if !found {
logger.Infof("******SI remoteSyncer.GetResource NOT FOUND: %s/%s", syncerConf.BrokerNamespace,
brokerAggregatedServiceImportName(serviceName, serviceNamespace))

for _, o := range agentController.serviceImportController.remoteSyncer.ListResources() {
resource.MustToMeta(o).SetManagedFields(nil)
logger.Infof(" ******Resource: %s", resource.ToJSON(o))
}

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 e809a51

Please sign in to comment.