-
Notifications
You must be signed in to change notification settings - Fork 346
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
Implement the controller for API BGPPolicy #6203
Open
hongliangl
wants to merge
1
commit into
antrea-io:main
Choose a base branch
from
hongliangl:20240222-bgp-controller-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
from
April 9, 2024 02:46
e986dd8
to
16f2901
Compare
hongliangl
added
kind/feature
Categorizes issue or PR as related to a new feature.
action/release-note
Indicates a PR that should be included in release notes.
labels
Apr 9, 2024
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
from
April 10, 2024 07:20
e93d476
to
7508c38
Compare
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
from
May 22, 2024 05:30
7508c38
to
e1e246a
Compare
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
2 times, most recently
from
May 30, 2024 10:40
f209e2a
to
3063737
Compare
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
3 times, most recently
from
June 6, 2024 12:25
57773d9
to
c9b727a
Compare
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
11 times, most recently
from
June 19, 2024 07:23
095d7da
to
5086b34
Compare
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
2 times, most recently
from
June 20, 2024 05:55
3bab09b
to
69c31a2
Compare
hongliangl
changed the title
Add BGPPolicy controller
Implement the controller for API BGPPolicy
Jun 20, 2024
This commit implements the controller of API `BGPPolicy`, designed to advertise Service IPs, Egress IPs, and Pod IPs to BGP peers from selected Nodes. According to the spec of `BGPPolicy`, the Node selector is used to select Nodes to which a `BGPPolicy` is applied. Multiple `BGPPolicies` can be applied to the same Node. However, only one `BGPPolicy` can be effective on a Node, with others serving as alternatives. The first `BGPPolicy` applied to a Node will be the effective one, and the latter ones will serve as alternatives. The effective one may be changed in the following cases: - The current effective BGPPolicy is updated and not applied to the Node. - The current effective BGPPolicy is deleted. - The antrea-agent is rebooted, and an original alternative BGPPolicy is synced first and becomes effective. The BGP server instance is only started for the effective BGPPolicy on a Node. If the effective BGPPolicy is changed, the corresponding BGP server instance will be terminated by calling the `Stop()` method, and a new BGP server instance will be created and started by calling the `Start()` method for the new effective BGPPolicy. To start a BGP server instance, ASN, routerID, and listen port must be specified. ASN and listen port are specified in the spec of the effective BGPPolicy. For routerID, if the cluster is IPv4 only or dual stack, the IPv4 NodeIP is used as the routerID; if the cluster is IPv6 only, the routerID must be specified in the Node annotation `antrea.io/bgp-route-id`. Additionally, a new BGP server instance should be created and started when any of ASN, routerID, or listen port changes. The information of the BGP peers is specified in the effective BGPPolicy. The unique identification of a BGP peer is the peer IP address. To reconcile the latest BGP peers: - Get the BGP peers to be added and add them by calling the `AddPeers` method of the BGP server instance. - Get the BGP peers to be deleted and delete them by calling the `RemovePeers` method of the BGP server instance. - Get the remaining BGP peers and calculate the updated BGP peers, then update them by calling the `UpdatePeers` method of the BGP server instance. The information of the IPs to be advertised can be calculated from the spec of the effective BGPPolicy. Currently, we advertise the IPs and CIDRs to all the BGP peers. To reconcile the latest IPs to all BGP peers: - If the BGP server instance is newly created and started, advertise all the IPs by calling the `AdvertiseRoutes` method. - If the BGP server instance is not newly created and started: - Get the IPs/CIDRs to be added and advertise them by calling the `AdvertiseRoutes` method. - Get the IPs/CIDRs to be removed and withdraw them by calling the `WithdrawRoutes` method. The feature is gated by the alpha `BGPPolicy` feature gate. Signed-off-by: Hongliang Liu <[email protected]>
hongliangl
force-pushed
the
20240222-bgp-controller-v2
branch
from
June 21, 2024 10:38
69c31a2
to
18c6f27
Compare
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
action/release-note
Indicates a PR that should be included in release notes.
area/transit/bgp
Issues or PRs related to BGP support.
kind/feature
Categorizes issue or PR as related to a new feature.
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.
This commit implements the controller of API
BGPPolicy
, designed to advertiseService IPs, Egress IPs, and Pod IPs to BGP peers from selected Nodes.
According to the spec of
BGPPolicy
, the Node selector is used to select Nodesto which a
BGPPolicy
is applied. MultipleBGPPolicies
can be applied to thesame Node. However, only one
BGPPolicy
can be effective on a Node, with othersserving as alternatives. The first
BGPPolicy
applied to a Node will be theeffective one, and the latter ones will serve as alternatives. The effective one
may be changed in the following cases:
first and becomes effective.
The BGP server instance is only started for the effective BGPPolicy on a Node.
Currently, the BGP server instance is implemented by goBGP, and more BGP
server implementations might be added later. If the effective BGPPolicy is changed,
the corresponding BGP server instance will be terminated by calling the
Stop()
method, and a new BGP server instance will be created and started by calling the
Start()
method for the new effective BGPPolicy.To start a BGP server instance, ASN, routerID, and listen port must be specified.
ASN and listen port are specified in the spec of the effective BGPPolicy. For
routerID, if the cluster is IPv4 only or dual stack, the IPv4 NodeIP is used as
the routerID; if the cluster is IPv6 only, the routerID must be specified in the
Node annotation
antrea.io/bgp-route-id
. Additionally, a new BGP server instanceshould be created and started when any of ASN, routerID, or listen port changes.
The information of the BGP peers is specified in the effective BGPPolicy. The
unique identification of a BGP peer is the peer IP address.
To reconcile the latest BGP peers:
AddPeers
method ofthe BGP server instance.
RemovePeers
method of the BGP server instance.
them by calling the
UpdatePeers
method of the BGP server instance.The information of the IPs to be advertised can be calculated from the spec of
the effective BGPPolicy. Currently, we advertise the IPs and CIDRs to all the
BGP peers.
To reconcile the latest IPs to all BGP peers:
by calling the
AdvertiseRoutes
method.AdvertiseRoutes
method.WithdrawRoutes
method.The feature is gated by the alpha
BGPPolicy
feature gate.Depends on #6009