Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport-0.13] Use endpoints from Broker while validating overlapping CIDRs #964

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading