projectcalico / calico

Cloud native networking and network security
https://docs.tigera.io/calico/latest/about/
Apache License 2.0
5.97k stars 1.33k forks source link

BGP configuration issues #7589

Open Garagoth opened 1 year ago

Garagoth commented 1 year ago

BGP configuration is quite inconvinient in some cases. (Original Slack thread: https://calicousers.slack.com/archives/CPTH1KS00/p1670603496145829) Mainly issue shows when sets of nodes communicate with different bgp routers and have different AS numbers.

Current Behavior

This is our case as each datacenter has different AS number assigned. While BGPPeer has node selector (so adding new node auto-configures it), setting local AS number is done by patching each nodes spec, something like this: kubectl get nodes -l datacenter=dc1 -o 'jsonpath={.items[*].metadata.name}' | xargs -I{} -d' ' calicoctl patch node {} --patch '{"spec":{"bgp": {"asNumber": "asn_from_dc1"}}}' (and repeat same for dc2 and dc3). Adding new nodes requires this to be run again, else new node gets default config and cannot communicate with BGP router properly.

Expected Behavior

Please expose resource that has node selector (or label selector, anything) that would allow configuring AS in similar manner as BGPPeer is configured. Or add AS to BGPPeer maybe?

Your Environment

Garagoth commented 2 weeks ago

Hi, Is there any progress or workaround better then I have in place? The problem is that remote AS number is different then local AS number. BGPConfiguration does not allow changing local AS number per node, docs says that it is valid only for default configuration. There is no CRD for projectcalico Node where this could be configured potentially. From current docs (https://docs.tigera.io/calico/latest/networking/configuring/bgp#change-as-number-for-a-particular-node and https://docs.tigera.io/calico/latest/reference/resources/bgpconfig) I do not see any other way, but I might have missed something...?

caseydavenport commented 2 weeks ago

We haven't added a node selector capability yet (I do think that is a good idea).

However, you can modify the AS number for a node using the following annotation on the Kubernetes node object:

projectcalico.org/ASNumber: <value>

This is an omission in our docs.