Skip to content

Commit

Permalink
Merge pull request #53 from terassyi/update-docs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
terassyi authored Dec 19, 2023
2 parents 85d7c4c + c52bce2 commit 54a4baa
Show file tree
Hide file tree
Showing 12 changed files with 1,787 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

# Sart

Sart is the Kubernetes network load-balancer using BGP in Rust.
Sart is the Kubernetes network load-balancer and CNI plugin for Kubernetes using BGP in Rust.

This project is inspired by [Metallb](https://github.com/metallb/metallb).
This project is inspired by [Metallb](https://github.com/metallb/metallb) and [Coil](https://github.com/cybozu-go/coil).

> [!WARNING]
> This project is under experimental.
> CNI feature is not implemented yet.
## Features

Expand All @@ -36,7 +37,7 @@ Sart can run on the container based environment using [kind](https://kind.sigs.k

And we also need to [install Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).

First, we have to create the test environment.
First, we have to create the test environment.
```console
sart$ make build-image
sart$ make certs
Expand Down
126 changes: 126 additions & 0 deletions docs/bgp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# How to Use

Sart has two CLI interfaces, sartd is for daemon and sart-cli is for controlling sartd.

### sartd bgp

We can run the BGP daemon with `sartd bgp` command.
And we can specify some parameters such as AS number and router id.
To integrate Fib manager, we have to give the path to the gRPC endpoint for fib manager.

```console
Usage: sartd bgp [OPTIONS]

Options:
-f, --file <FILE> Config file path for BGP daemon
-a, --as <AS> Local AS Number
-d, --format <FORMAT> Log display format [default: plain] [possible values: plain, json]
-r, --router-id <ROUTER_ID> Local router id(must be ipv4 format)
--fib <FIB_ENDPOINT> Fib endpoint url(gRPC) exp) localhost:5001
--table-id <FIB_TABLE_ID> Target fib table id(default is main(254))
--exporter <EXPORTER> Exporter endpoint url
-l, --level <LEVEL> Log level(trace, debug, info, warn, error) [default: info]
-h, --help Print help
```

We also can configure BGP with a configuration file written by Yaml.
This is the example of config files.

```yaml
asn: 65000
router_id: 10.0.0.2
multi_path: true
neighbors:
- asn: 65010
router_id: 10.0.0.3
address: 10.0.0.3
- asn: 65020
router_id: 10.0.1.3
address: 10.0.1.3
```
## sart Commands
To control running daemons, we can use sart-cli commands.
Now we support following subcommands
- bgp
### sart bgp
`sart bgp` command accepts `global` level and `neighbor` level subcommands.

`global` level can get and set AS number or router id of the local daemon.
And it also can configure RIB(Loc-RIB) information.

```console
root@233eff855e37:/# sart bgp global rib -h
Usage: sart bgp global rib [OPTIONS] <COMMAND>
Commands:
get
add
del
help Print this message or the help of the given subcommand(s)
Options:
-d, --format <FORMAT> Display format [default: plain] [possible values: plain, json]
-e, --endpoint <ENDPOINT> Endpoint to API server [default: localhost:5000]
-a, --afi <AFI> Address Family Information [default: ipv4] [possible values: ipv4, ipv6]
-s, --safi <SAFI> Sub Address Family Information [default: unicast] [possible values: unicast, multicast]
-h, --help Print help
```

For example, to add a prefix to running BGP daemon, run this command.
```console
root@233eff855e37:/# sart bgp global rib add 10.0.10.0/24 -a ipv4 -t origin=igp
```

`neighbor` level can get and set neighbor information.

**Some commands are not implemented yet.**

```console
root@233eff855e37:/# sart bgp neighbor -h
Usage: sart bgp neighbor [OPTIONS] <COMMAND>
Commands:
get
list
add
del
rib
policy
help Print this message or the help of the given subcommand(s)
```

For example, to add a neighbor, run this.

```console
root@233eff855e37:/# sart bgp neighbor add 10.10.0.1 65000
```

## gRPC Interfaces

Sartd has gRPC interfaces.
Sart-cli calls this interface internally.

For detail, please see [proto/](https://github.com/teassyi/sart/blob/main/proto).

## Integrate with FIB Manager

To install paths received from other peers, we need to a FIB manager.
For example, [FRR](https://frrouting.org/) needs to run [zebrad](https://docs.frrouting.org/en/latest/zebra.html) to install paths bgpd gets.

For `sartd-bgp`, we can run `sartd-fib` as the FIB manager.
`Sartd-fib` has gRPC interface to interact with other component.

> [!NOTE]
>`Sartd-fib` is in the PoC phase.

To integrate with `sartd-fib`, we have to specify the gRPC endpoint to FIB manager as a parameter like below.

```console
$ sartd bgp --fib localhost:5010
```
7 changes: 3 additions & 4 deletions docs/controller/design.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Design of sart-controller
# Design of sart kubernetes custom controller

Sart-controller is a self made Kubernetes network load balancer for announcing [externalIP of Service](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer).
Sart-controller is a self made Kubernetes network load balancer for announcing [addresses Service type LoadBalancer](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer).

[metallb](https://github.com/metallb/metallb) has a similar feature.

To announce load balancer IP addresses to the external system, sart-controller uses BGP.
So we need BGP speakers outside the Kubernetes cluster and also BGP speaker inside the cluster.
Local(inside) BGP speakers are on the each nodes as DaemonSet.
And sart-controller controls these speakers via API.
Now, we can only use sartd-bgp as local speakers.

> **Note**
> Sart-controller is an alpha system.
> Sart is an alpha system.
## CRD based architecture

Expand Down
Loading

0 comments on commit 54a4baa

Please sign in to comment.