Skip to content

Commit

Permalink
Use endpoints from Broker while validating overlapping CIDRs
Browse files Browse the repository at this point in the history
As part of the following PR[1], we no longer sync an endpoint
from the Broker if the endpoint has any overlapping CIDRs with the
local cluster. This was done to avoid issues on the Gateway node.
Consequently, the subctl diagnose code should ideally examine
the endpoints on Broker when validating overlapping CIDRs instead
of inspecting the endpoints on the local cluster. This PR addresses
this issue.

[1] submariner-io/submariner#2263

Signed-off-by: Sridhar Gaddam <[email protected]>
  • Loading branch information
sridhargaddam authored and tpantelis committed Nov 3, 2023
1 parent a446e28 commit 706e753
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/diagnose/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ package diagnose

import (
"context"

"github.com/submariner-io/admiral/pkg/reporter"
"github.com/submariner-io/subctl/internal/constants"
"github.com/submariner-io/subctl/internal/restconfig"
"github.com/submariner-io/subctl/pkg/cluster"
"github.com/submariner-io/submariner-operator/pkg/client"
"github.com/submariner-io/submariner/pkg/cidr"
"github.com/submariner-io/submariner/pkg/cni"
v1 "k8s.io/api/core/v1"
Expand All @@ -45,7 +46,19 @@ func checkOverlappingCIDRs(clusterInfo *cluster.Info, status reporter.Interface)

defer status.End()

endpointList, err := clusterInfo.ClientProducer.ForSubmariner().SubmarinerV1().Endpoints(clusterInfo.Submariner.Namespace).List(
brokerRestConfig, brokerNamespace, err := restconfig.ForBroker(clusterInfo.Submariner, nil)
if err != nil {
status.Failure("Error getting the Broker's REST config: %v", err)
return false
}

clientProducer, err := client.NewProducerFromRestConfig(brokerRestConfig)
if err != nil {
status.Failure("Error creating broker client Producer: %v", err)
return false
}

endpointList, err := clientProducer.ForSubmariner().SubmarinerV1().Endpoints(brokerNamespace).List(
context.TODO(), metav1.ListOptions{})
if err != nil {
status.Failure("Error listing the Submariner endpoints: %v", err)
Expand Down

0 comments on commit 706e753

Please sign in to comment.