Skip to content

Conversation

YutaroHayakawa
Copy link
Member

This PR solves the following problems for BGP route policy reconciler.

  1. Use netip.Addr for MatchNeighbors field in the policy condition. This is for efficiency and also fixes the issue that we breach the zone information for the IPv6 link-local address peers upon string conversion.
  2. peerAddressFromPolicy only returns the first peer appears in the policy. This becomes a problem when we have multiple neighbors in the policy. Fix it to return multiple neighbors properly.
  3. Route policy reconciler doesn't reset inbound route policy. This is not a problem for our current use cases because we only advertise the routes. However, for the sake of future extensibility, we'll generalize the mechanism and properly do inbound soft reset when there's a change in the inbound route policy.
bgp: Refactor route policy reconciler

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jul 2, 2025
@YutaroHayakawa YutaroHayakawa added the release-note/misc This PR makes changes that have no direct user impact. label Jul 2, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jul 2, 2025
@YutaroHayakawa YutaroHayakawa added the area/bgp Impacts the Border Gateway Protocol feature. label Jul 2, 2025
Currently, API => Agent route policy conversions such as
ToAgentRoutePolicies are not used. Remove them for making maintenance
easier.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
@YutaroHayakawa YutaroHayakawa force-pushed the yutaro/refactor-route-policy-reconciler branch 3 times, most recently from d7ff68b to 0bf3bf4 Compare July 2, 2025 16:10
@YutaroHayakawa
Copy link
Member Author

/test

@YutaroHayakawa YutaroHayakawa marked this pull request as ready for review July 2, 2025 17:26
@YutaroHayakawa YutaroHayakawa requested a review from a team as a code owner July 2, 2025 17:26
Currently, the RoutePolicyConditions.MatchNeighbors option uses string
to store the neighbor IP address. Using string makes the actual
representation used for the IP address anbiguous. Use netip.Addr for
type safety, efficiency, and clarity for readers.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Fix peerAddressFromPolicy to return all peer addresses in the policy
instead of returning only the first one.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
Currently, the ResetRoutePolicies only resets outbound. However,
whenever we have an update for inbound policy, we should reset inbount.
Fix it to handle both direction properly.

This also fixes the bug where the old peers in the updated policies were
not resetted. Add some test cases to ensure the resetting is called
properly.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
@YutaroHayakawa YutaroHayakawa force-pushed the yutaro/refactor-route-policy-reconciler branch from 0bf3bf4 to df1d073 Compare July 2, 2025 18:59
@YutaroHayakawa
Copy link
Member Author

/test

@YutaroHayakawa YutaroHayakawa requested a review from rastislavs July 2, 2025 19:13
@YutaroHayakawa
Copy link
Member Author

@YutaroHayakawa YutaroHayakawa added this pull request to the merge queue Jul 4, 2025
Merged via the queue into main with commit 08057be Jul 4, 2025
372 of 375 checks passed
@YutaroHayakawa YutaroHayakawa deleted the yutaro/refactor-route-policy-reconciler branch July 4, 2025 04:38
@YutaroHayakawa YutaroHayakawa added the affects/v1.18 This issue affects v1.18 branch label Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/v1.18 This issue affects v1.18 branch area/bgp Impacts the Border Gateway Protocol feature. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants