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

cfp/37315 bgp session default gateway #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

naveenachyuta
Copy link

This PR adds a CFP for Auto Peer Discovery for Cilium BGP cilium/cilium#37315

@naveenachyuta naveenachyuta marked this pull request as ready for review February 26, 2025 05:23
@xmulligan
Copy link
Member

cc: @cilium/sig-bgp

Copy link
Member

@YutaroHayakawa YutaroHayakawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for the late reply. I made an initial review.

bgpInstances:
- name: "65001"
localASN: 65001
autoDiscovery: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make this a stanza under peers? We can put address family information under the new stanza as well.

peers:
- name: peer0
  peerASN: 65000
  peerConfigRef:
    name: peer-config0
  autoDiscovery:
    mode: default-gateway
    addressFamily: ipv4 // or ipv6

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya i agree. it will provide flexibility per peer. but i'm curious about the use-case. What is the use-case to use different discovery mechanisms for each peer OR auto-discovery for one peer and static ip for another?

Copy link
Member

@YutaroHayakawa YutaroHayakawa Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, using default gateway to peer with ToR and use static ip to peer with route reflector. Whether or not this is realistic, I'd prefer the option that gives the maximum leverage. The instance-level knob enforces users to use default gateway for all peers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay i was wondering if there is an existing use-case.
but i agree with you. it provides flexibility for sure.

Comment on lines 61 to 88
In multi-homed environments (i.e., multiple default gateways leading to different ASNs), this proposal does not address which gateway belongs to which peer ASN.

example multi-homed config:
bgpInstances:
- name: "65001"
localASN: 65001
peers:
- name: "65000"
peerASN: 65000
peerConfigRef:
name: "cilium-peer"
- name: "65011"
peerASN: 65011
peerConfigRef:
name: "cilium-peer"

If multiple default gateways exist, we cannot reliably match them to different peer ASNs. One workaround is to use same local ASN on both the ToRs for bgp sessions with the k8s node, and bgp cluster config will have one peer configured.

proposed multi-homed config:
bgpInstances:
- name: "65001"
localASN: 65001
peers:
- name: "65000"
peerASN: 65000
afi: ipv4
peerConfigRef:
name: "cilium-peer"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as long as the selection is consistent, it is ok to select only one of them and use it. For example, we can use metric to compare them. In my understanding, Linux doesn't allow us to create two default gateway with the same metric. So, it should be possible prefer the route with the lowest metric for example.

Since we are anyways subscribing to the netlink, we can also do failover when one of them disappears.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate on this?
are you saying that in multi-homing, we will create a bgp session with default gateway of lowest metric? If that fails, we will create a bgp session with the other?
i'm not familiar with netlink. how will that help with failover?

Copy link
Member

@YutaroHayakawa YutaroHayakawa Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you saying that in multi-homing, we will create a bgp session with default gateway of lowest metric?

Yes, right. Then, when the lowest one disappears, we'll be notified through statedb (statedb watches netlink, so we don't need to deal with it directly). Then now we can select the one left on the routing table (the higher one). As a result, we are failing over.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay got it. If you can send sample code or parts of cilium code that i can update to make this work, that would be helpful.

@YutaroHayakawa YutaroHayakawa self-requested a review March 12, 2025 00:17
Copy link
Member

@YutaroHayakawa YutaroHayakawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I meant to request change.

add code blocks for configs

Signed-off-by: naveenachyuta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants