Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

support workloads across multiple hosts using same /26 #8

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

ishidawataru
Copy link
Contributor

The current implementation only advertises aggregated routes which are
stored in etcd. When workloads are deployed across multiple hosts using
same /26, we need to import /32 host routes from kernel and advertise them.

closes #5
closes https://github.com/projectcalico/calico-containers/issues/1362

main.go Outdated
peerASN = *asn
}
if spec.IPv4Address != nil {
v4 = spec.IPv4Address.String()
Copy link
Contributor

@robbrockbank robbrockbank Feb 14, 2017

Choose a reason for hiding this comment

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

We've been a little unusual here and modified our IPv4Address and IPv6Address fields to be CIDRs instead of just IPs. This way we can include the subnet information (and have updated our IPIP behavior to provide the option of only using IPIP if routing to a host that is off-subnet). You'll need to:

  • Update this PR to use the new IPv4Address and IPv6Address formats.
  • (Future work) Support the new IPIP mode field to only use IPIP off-subnet.

Also, I'd like to retire the use of the IP, IP6 and AS environments and just use the Node IPv4Address and IPv6Address fields. We currently are only maintaining them for the Go BGP daemon. Could you instead check if the node.Metadata.Name is equal to the NODENAME environment - that will be the equivalent to checking if the node is the local node.

main.go Outdated
type Server struct {
t tomb.Tomb
bgpServer *bgpserver.BgpServer
cli *calicocli.Client
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a minor nit, but I find cli as a contraction for client confusing since cli is generally means command line interface. Would be nicer to expand to client.

main.go Outdated
}

// monitor routes from other BGP peers and update FIB
s.t.Go(s.monitorPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the difference between monitorX and watchX refer to something subtly different, or could they all be watchX?

@robbrockbank
Copy link
Contributor

A general comment: A lot of the functions/methods could really benefit from having useful doc strings describing what the function is doing - that will certainly be useful in the future when we need to update when we add watcher support to libcalico-go and backends other than etcd.

main.go Outdated
return bgpServer.DeleteNeighbor(n)
case "set":
return s.bgpServer.DeleteNeighbor(n)
case "set", "create":
Copy link
Contributor

Choose a reason for hiding this comment

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

Also update and compareAndSwap for completeness?

@robbrockbank
Copy link
Contributor

One more thing - I thought I'd seen a calicoctl PR to test this - but I can't see it now - there is a placeholder comment in the ST code for testing this with GoBGP.

@ishidawataru
Copy link
Contributor Author

@robbrockbank Hi thanks for your review.
Reflected your comments. PTAL

@ishidawataru ishidawataru force-pushed the dev branch 2 times, most recently from 9412893 to 3c61637 Compare February 16, 2017 03:18
This commit tries to make calico-bgp-daemon works identical with BIRD backend.

When multiple hosts are sharing same /26, the prefix is only advertised
from the host which used the prefix first.

To get reachability, succeeding hosts needs to advertise /32 routes
which are taken from the /26 and assigned to each workloads.
The /32 routes can be learned by subscribing the netlink updates.

The first host which used the prefix needs to suppress advertising /32
routes and only advertise the /26 route.
Export policy('calico_aggr') is used to implement this behavior.

calico_aggr consist of two statements.
The first statement allows the /26 routes to be advertised, and the
second one rejects the /32 routes.

you can check the current policy by using gobgp command on calico/node

$ gobgp policy
Name calico_aggr:
    StatementName calico_aggr_stmt0:
      Conditions:
        PrefixSet: any aggregated
      Actions:
         accept
    StatementName calico_aggr_stmt1:
      Conditions:
        PrefixSet: any host
      Actions:
         reject

$ gobgp policy prefix
NAME        PREFIX
aggregated  192.168.1.0/26 26..26
host        192.168.1.0/26 26..32

Signed-off-by: ISHIDA Wataru <[email protected]>
@ishidawataru
Copy link
Contributor Author

@robbrockbank Rebased on the master. PTAL!

@ishidawataru
Copy link
Contributor Author

@robbrockbank ping. After this get merged, I'll work on this

@tomdee tomdee modified the milestone: Calico v2.2.0? Mar 1, 2017
@robbrockbank
Copy link
Contributor

LGTM

@robbrockbank robbrockbank merged commit 8ace168 into projectcalico:master Mar 2, 2017
@robbrockbank
Copy link
Contributor

Hi @ishidawataru - I've merged this one! :-)

@ishidawataru ishidawataru deleted the dev branch March 2, 2017 23:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants