Skip to content

Commit 706e753

Browse files
sridhargaddamtpantelis
authored andcommitted
Use endpoints from Broker while validating overlapping CIDRs
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]>
1 parent a446e28 commit 706e753

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/diagnose/deployments.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ package diagnose
2020

2121
import (
2222
"context"
23-
2423
"github.com/submariner-io/admiral/pkg/reporter"
2524
"github.com/submariner-io/subctl/internal/constants"
25+
"github.com/submariner-io/subctl/internal/restconfig"
2626
"github.com/submariner-io/subctl/pkg/cluster"
27+
"github.com/submariner-io/submariner-operator/pkg/client"
2728
"github.com/submariner-io/submariner/pkg/cidr"
2829
"github.com/submariner-io/submariner/pkg/cni"
2930
v1 "k8s.io/api/core/v1"
@@ -45,7 +46,19 @@ func checkOverlappingCIDRs(clusterInfo *cluster.Info, status reporter.Interface)
4546

4647
defer status.End()
4748

48-
endpointList, err := clusterInfo.ClientProducer.ForSubmariner().SubmarinerV1().Endpoints(clusterInfo.Submariner.Namespace).List(
49+
brokerRestConfig, brokerNamespace, err := restconfig.ForBroker(clusterInfo.Submariner, nil)
50+
if err != nil {
51+
status.Failure("Error getting the Broker's REST config: %v", err)
52+
return false
53+
}
54+
55+
clientProducer, err := client.NewProducerFromRestConfig(brokerRestConfig)
56+
if err != nil {
57+
status.Failure("Error creating broker client Producer: %v", err)
58+
return false
59+
}
60+
61+
endpointList, err := clientProducer.ForSubmariner().SubmarinerV1().Endpoints(brokerNamespace).List(
4962
context.TODO(), metav1.ListOptions{})
5063
if err != nil {
5164
status.Failure("Error listing the Submariner endpoints: %v", err)

0 commit comments

Comments
 (0)