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

bgp: support multiple peer addresses #3283

Merged
merged 2 commits into from
Oct 8, 2023
Merged

Conversation

zhangzujian
Copy link
Member

@zhangzujian zhangzujian commented Oct 7, 2023

What type of this PR

  • Features

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, and yamls/speaker.yaml files, and adds the yamls/clab-bgp-ha.yaml.j2 and yamls/clab-bgp.yaml.j2 files.

🤖 Generated by Copilot at c20e681

We are the speakers of the BGP
We create the topologies of doom
We parse the flags and advertise the routes
We render the templates with Jinja2

HOW

🤖 Generated by Copilot at c20e681

  • Add new targets to the Makefile to create and destroy network topologies with BGP routers using the containerlab tool, and to install and configure the speaker daemonset on the kind cluster (link, link, link, link, link, link, link, link)
  • Add new template files yamls/clab-bgp.yaml.j2 and yamls/clab-bgp-ha.yaml.j2 for the containerlab tool to render the network topologies with one and two BGP routers respectively (link, link)
  • Modify the Configuration struct and the ParseFlags function in pkg/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)
  • Modify the initBgpServer function in pkg/speaker/config.go to create a Peer object and call the AddPeer method of the BGP server for each address in each IP family (link, link, link)
  • Modify the syncSubnetRoutes function in pkg/speaker/subnet.go to handle different values of the ovn.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)
  • Modify the syncSubnetRoutes function in pkg/speaker/subnet.go to replace the conditions of checking the NeighborAddress and NeighborIPv6Address fields with the length of the NeighborAddresses and NeighborIPv6Addresses slices (link, link)
  • Modify the addRoute, getNlriAndAttrs, and delRoute functions in pkg/speaker/subnet.go to support different path attributes for different neighbors, and to call the AddPath and DeletePath methods of the BGP server with each slice of path attributes (link, link, link)
  • Add a new environment variable KUBE_NODE_NAME to the speaker container in the yamls/speaker.yaml file, which passes the node name to the speaker process as the node-name flag (link)

@zhangzujian zhangzujian added the feature New network feature label Oct 7, 2023
@zhangzujian zhangzujian linked an issue Oct 7, 2023 that may be closed by this pull request
@zhangzujian zhangzujian marked this pull request as ready for review October 7, 2023 14:28
@zhangzujian zhangzujian requested a review from oilbeater October 7, 2023 14:29
@zhangzujian zhangzujian merged commit 5172207 into kubeovn:master Oct 8, 2023
56 checks passed
@zhangzujian zhangzujian deleted the bgp-ha branch October 8, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New network feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve bgp peer addresses management
2 participants