Skip to content

Commit

Permalink
Removed SBDB for more than one node per zone deployment
Browse files Browse the repository at this point in the history
* Removed SBDB configuration as we are not programming SBDB now
will be removed for all the cases once we compltely move to the new
implemnetation

* Fixed issues in naming

Signed-off-by: Aswin Suryanarayanan <[email protected]>
  • Loading branch information
aswinsuryan committed Jul 27, 2023
1 parent 376ac21 commit 6b71919
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pkg/discovery/network/ovnkubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func discoverOvnNodeClusterNetwork(ctx context.Context, client controllerClient.
return nil, err
}

endpointList, err := FindEndpoint(ctx, client, ovnPod.Namespace)
endpointList, err := findEndpoint(ctx, client, ovnPod.Namespace)
if err != nil {
return nil, errors.Wrapf(err, "Error retrieving the endpoints from namespace %q", ovnPod.Namespace)
}
Expand All @@ -113,32 +113,27 @@ func discoverOvnNodeClusterNetwork(ctx context.Context, client controllerClient.
func createLocalClusterNetwork() *ClusterNetwork {
return &ClusterNetwork{
PluginSettings: map[string]string{
OvnNBDB: "local",
OvnSBDB: "local",
OvnNBDB: "unix:/var/run/openvswitch/ovnnb_db.sock",
},
}
}

func createClusterNetworkWithEndpoints(endPoints []corev1.Endpoints) *ClusterNetwork {
pluginSettings := map[string]string{}
var OvnNBDBIPs, OVNSBDBIps string
var northboundDBIPs string

for index := 0; index < len(endPoints); index++ {
for _, subset := range endPoints[index].Subsets {
for _, port := range subset.Ports {
if strings.Contains(port.Name, "north") {
OvnNBDBIPs += fmt.Sprintf("%s:%s:%s:%s:%d,",
"IC:", endPoints[index].Name, port.Protocol, subset.Addresses[0].IP, OvnNBDBDefaultPort)
} else if strings.Contains(port.Name, "south") {
OVNSBDBIps += fmt.Sprintf("%s:%s:%s:%s:%d,",
"IC:", endPoints[index].Name, port.Protocol, subset.Addresses[0].IP, OvnSBDBDefaultPort)
northboundDBIPs += fmt.Sprintf("%s:%s:%s:%s:%d,",
"IC", endPoints[index].Name, port.Protocol, subset.Addresses[0].IP, OvnNBDBDefaultPort)
}
}
}
}

pluginSettings[OvnNBDB] = OvnNBDBIPs
pluginSettings[OvnSBDB] = OVNSBDBIps
pluginSettings[OvnNBDB] = northboundDBIPs

return &ClusterNetwork{
PluginSettings: pluginSettings,
Expand All @@ -162,7 +157,7 @@ func updateClusterNetworkFromConfigMap(ctx context.Context, client controllerCli
}
}

func FindEndpoint(ctx context.Context, client controllerClient.Client, endpointNameSpace string) (*corev1.EndpointsList, error) {
func findEndpoint(ctx context.Context, client controllerClient.Client, endpointNameSpace string) (*corev1.EndpointsList, error) {
endpointsList := &corev1.EndpointsList{}
listOptions := &controllerClient.ListOptions{
Namespace: endpointNameSpace,
Expand Down

0 comments on commit 6b71919

Please sign in to comment.