-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: AlexandreBrg <burgoni@pm.me>
- Loading branch information
1 parent
4f9a81b
commit 64e38d9
Showing
6 changed files
with
145 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1 @@ | ||
# Controller | ||
|
||
## Configuration | ||
|
||
| Environment variable | Default | Description | | ||
|:---------------------|-------------------------|--------------------------------| | ||
| `DATABASE_LOCATION` | `/var/lib/rik/data/` | Database data location | | ||
| `SCHEDULER_URL` | `http://localhost:4996` | Host location of the scheduler | | ||
| `PORT` | `5000` | Port to listen on | | ||
|
||
|
||
## Database structure | ||
|
||
**Workloads**: | ||
|
||
* `element_type`: `/workload` | ||
|
||
* `element_id`: `/workload/${WORKLOAD_KIND}/${NAMESPACE}/${WORKLOAD_NAME}` | ||
* *WORKLOAD_KIND*: One of`pods`, `function` | ||
* *NAMESPACE*: Static `default` | ||
* *WORKLOAD_NAME*: Dynamically defined | ||
|
||
|
||
**Instances**: | ||
|
||
* `element_type`: `/instance` | ||
|
||
* `element_id`: `/instance/${WORKLOAD_KIND}/${NAMESPACE}/${INSTANCE_NAME}` | ||
* *WORKLOAD_KIND*: One of`pods`, `function` | ||
* *NAMESPACE*: Static `default` | ||
* *INSTANCE_NAME*: Dynamically defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1 @@ | ||
# Network | ||
|
||
This project has network features, it's state is **unstable** and should be used | ||
with caution as it is managing your network interfaces and routing. We are doing | ||
our best not to break your system's network! | ||
|
||
*In this document words Network and SDN (Software Designed Network) have the | ||
same meaning*. | ||
|
||
## Workloads | ||
|
||
Current workloads cannot be configured with network implementation, however | ||
`Function` workload implement a first version of network configuration which | ||
can't be configured yet. | ||
|
||
## Riklet | ||
|
||
This component onboard a network component which will manage network exposure | ||
and routing. Depending on the workload, it will be configured to use a specific | ||
network implementation. For now, only `Function` workload have an implementation | ||
of network configuration. This implementation is based on `iptables` and | ||
[`rtnetlink`](https://man7.org/linux/man-pages/man7/rtnetlink.7.html). | ||
|
||
## Function network | ||
|
||
Current implementation is based on usage of `iptables`, it will apply NAT rules | ||
on current network configuration. Moreover, it will apply PAT (Port Address | ||
Translation) on the host machine to expose the workload on a specific port. | ||
|
||
```ignore | ||
┌──────────────────────────────────────────────────────────────────┐ | ||
│ Host Machine (riklet) │ | ||
│ │ | ||
│ │ | ||
│ ┌─────────────────────────────┐ ┌─────────────────────────┐ │ | ||
│ │Iptables │ │ Function Instance │ │ | ||
│ │ │ │ │ │ | ||
│ │ ┌─────────────────────────┐ │ │ │ │ | ||
│ │ │APPLY NAT ON │ │ │┌───────────────────────┐│ │ | ||
│ │ │host:${port} │ │ ││ Guest_veth ││ │ | ||
│ │ │ │ │ ││ ││ │ | ||
│ │ │TO │─┼┐ │└───────────────────────┘│ │ | ||
│ │ │host_tap:${service_port} │ ││ │ ▲ │ │ | ||
│ │ │ │ ││ └────────────┼────────────┘ │ | ||
│ │ └─────────────────────────┘ ││ │ │ | ||
│ │ ▲ ││ │ │ | ||
│ └──────────────┼──────────────┘│ ┌───────────────────────┐ │ | ||
│ │ │ │ Host_tap │ │ | ||
│ │ └──▶│ │ │ | ||
│ │ └───────────────────────┘ │ | ||
│ ┌───────────────────────┐ │ | ||
│ │Host Ethernet Interface│ │ | ||
│ │ │ │ | ||
│ └───────────────────────┘ │ | ||
│ ▲ │ | ||
└─────────────────┼────────────────────────────────────────────────┘ | ||
│ | ||
│ | ||
│ | ||
.───────. | ||
,─' '─. | ||
,' `. | ||
; : | ||
│ │ | ||
│ World Wide Web │ | ||
: ; | ||
╲ ╱ | ||
`. ,' | ||
'─. ,─' | ||
`─────' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Controller | ||
|
||
## Configuration | ||
|
||
| Environment variable | Default | Description | | ||
|:---------------------|-------------------------|--------------------------------| | ||
| `DATABASE_LOCATION` | `/var/lib/rik/data/` | Database data location | | ||
| `SCHEDULER_URL` | `http://localhost:4996` | Host location of the scheduler | | ||
| `PORT` | `5000` | Port to listen on | | ||
|
||
|
||
## Database structure | ||
|
||
**Workloads**: | ||
|
||
* `element_type`: `/workload` | ||
|
||
* `element_id`: `/workload/${WORKLOAD_KIND}/${NAMESPACE}/${WORKLOAD_NAME}` | ||
* *WORKLOAD_KIND*: One of`pods`, `function` | ||
* *NAMESPACE*: Static `default` | ||
* *WORKLOAD_NAME*: Dynamically defined | ||
|
||
|
||
**Instances**: | ||
|
||
* `element_type`: `/instance` | ||
|
||
* `element_id`: `/instance/${WORKLOAD_KIND}/${NAMESPACE}/${INSTANCE_NAME}` | ||
* *WORKLOAD_KIND*: One of`pods`, `function` | ||
* *NAMESPACE*: Static `default` | ||
* *INSTANCE_NAME*: Dynamically defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Network | ||
|
||
This project has network features, it's state is **unstable** and should be used | ||
with caution as it is managing your network interfaces and routing. We are doing | ||
our best not to break your system's network! | ||
|
||
## Workloads | ||
|
||
Current workloads cannot be configured with network implementation, however | ||
`Function` workload implement a first version of network configuration which | ||
can't be configured yet. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Riklet SDN | ||
|
||
This component onboard a network component which will manage network exposure | ||
and routing. Depending on the workload, it will be configured to use a specific | ||
network implementation. For now, only `Function` workload have an implementation | ||
of network configuration. This implementation is based on `iptables` and | ||
[`rtnetlink`](https://man7.org/linux/man-pages/man7/rtnetlink.7.html). | ||
|
||
## Function network implementation | ||
|
||
This network feature allows you to forward traffic from a specific port to a | ||
Function instance port. We achieve this using `iptables`, a widely used linux | ||
tool for managing network traffic. The translation of IP and port is targetting | ||
a [TAP](https://www.gabriel.urdhr.fr/2021/05/08/tuntap/) interface on the | ||
machine that is communicating with the Function instance (microVM). | ||
|
||
```ignore | ||
┌──────────────────────────────────────────────────────────────────┐ | ||
│ Host Machine (riklet) │ | ||
│ │ | ||
│ │ | ||
│ ┌─────────────────────────────┐ ┌─────────────────────────┐ │ | ||
│ │Iptables │ │ Function Instance │ │ | ||
│ │ │ │ │ │ | ||
│ │ ┌─────────────────────────┐ │ │ │ │ | ||
│ │ │APPLY NAT ON │ │ │┌───────────────────────┐│ │ | ||
│ │ │host:${port} │ │ ││ Guest_veth ││ │ | ||
│ │ │ │ │ ││ ││ │ | ||
│ │ │TO │─┼┐ │└───────────────────────┘│ │ | ||
│ │ │host_tap:${service_port} │ ││ │ ▲ │ │ | ||
│ │ │ │ ││ └────────────┼────────────┘ │ | ||
│ │ └─────────────────────────┘ ││ │ │ | ||
│ │ ▲ ││ │ │ | ||
│ └──────────────┼──────────────┘│ ┌───────────────────────┐ │ | ||
│ │ │ │ Host_tap │ │ | ||
│ │ └──▶│ │ │ | ||
│ │ └───────────────────────┘ │ | ||
│ ┌───────────────────────┐ │ | ||
│ │Host Ethernet Interface│ │ | ||
│ │ │ │ | ||
│ └───────────────────────┘ │ | ||
│ ▲ │ | ||
└─────────────────┼────────────────────────────────────────────────┘ | ||
│ | ||
``` | ||
|
||
This is what the network configuration looks like when you deploy a Function | ||
instance with a port mapping, please not it is very specific to Function. The | ||
`host_tap` interface is created by the | ||
`riklet` and is used to communicate with the Function instance. The `Guest_veth` | ||
interface is created by the `firecracker` microVM and is used to communicate | ||
with the `host_tap` interface. The `host_tap` is connecteed to the internet and | ||
is not restricted in bandwidth. | ||
|
||
## Iptables | ||
|
||
Riklet will use a custom chain called `RIKLET` on the table nat to do DNAT (Destination NAT), it | ||
matches two use cases: | ||
|
||
- Local processes: when another workload wants to communicate with a Function | ||
instance | ||
- Internet: when the workload needs to be exposed externally on the worker node | ||
|
||
|
||
```ignore | ||
.─────────────────. .─────────────────. | ||
,─' '─. ,─' '─. | ||
( Local processes ) ( Internet ) | ||
`──. _.─' `──. _.─' | ||
`───────────────' `───────────────' | ||
│ │ | ||
│ │ | ||
│ │ | ||
▼ ▼ | ||
┌────────────────────┐ ┌────────────────────┐ | ||
│ OUTPUT (nat) │ │ PREROUTING (nat) │ | ||
└────────────────────┘ └────────────────────┘ | ||
│ │ | ||
│ │ | ||
│ ┌──────────────────────────┤ | ||
│ │ │ | ||
▼ ▼ ▼ | ||
┌────────────────────┐ ┌────────────────────┐ | ||
│ RIKLET (nat) │───────────▶│ FORWARD │ | ||
└────────────────────┘ └────────────────────┘ | ||
│ | ||
│ | ||
│ | ||
│ | ||
▼ | ||
┌────────────────────┐ | ||
│ POSTROUTING │ | ||
└────────────────────┘ | ||
│ | ||
│ | ||
│ | ||
▼ | ||
``` |