bgp: support multiple peer addresses #3283
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of this PR
Which issue(s) this PR fixes:
Fixes #(issue-number)
WHAT
🤖 Generated by Copilot at c20e681
This pull request adds new features and tests for the BGP speaker functionality of kube-ovn. It allows the speaker to support multiple BGP neighbors, local subnets, and node name based routes. It also adds new Makefile targets and template files for containerlab and kind to create network topologies for testing the speaker in different scenarios. It modifies the
pkg/speaker/config.go
,pkg/speaker/subnet.go
, andyamls/speaker.yaml
files, and adds theyamls/clab-bgp-ha.yaml.j2
andyamls/clab-bgp.yaml.j2
files.🤖 Generated by Copilot at c20e681
HOW
🤖 Generated by Copilot at c20e681
yamls/clab-bgp.yaml.j2
andyamls/clab-bgp-ha.yaml.j2
for the containerlab tool to render the network topologies with one and two BGP routers respectively (link, link)Configuration
struct and theParseFlags
function inpkg/speaker/config.go
to support multiple BGP neighbors for each IP family, and to get the node name from the command line argument or the environment variable (link, link, link, link, link, link, link)initBgpServer
function inpkg/speaker/config.go
to create aPeer
object and call theAddPeer
method of the BGP server for each address in each IP family (link, link, link)syncSubnetRoutes
function inpkg/speaker/subnet.go
to handle different values of theovn.kubernetes.io/bgp
annotation on the subnets and the pods, and to filter the routes based on the node name of the pod and the speaker (link)syncSubnetRoutes
function inpkg/speaker/subnet.go
to replace the conditions of checking theNeighborAddress
andNeighborIPv6Address
fields with the length of theNeighborAddresses
andNeighborIPv6Addresses
slices (link, link)addRoute
,getNlriAndAttrs
, anddelRoute
functions inpkg/speaker/subnet.go
to support different path attributes for different neighbors, and to call theAddPath
andDeletePath
methods of the BGP server with each slice of path attributes (link, link, link)KUBE_NODE_NAME
to the speaker container in theyamls/speaker.yaml
file, which passes the node name to the speaker process as thenode-name
flag (link)