A lot of work has been done to have something working in RIK, especially in Riklet. Either to run containers or VMs. We'd like to keep things simple and add an abstraction around methods that are deploying workloads. The idea is to create a trait (or more) in order to define an implementation of a runtime based on workload kind (Function or Pod).
The responsability of those implementation should be kept to deploying the infrastructure to run a workload, this doesn't concern network. For instance, FunctionRuntimeInstance is expected to download a rootFS and start the microVM with ability to monitor it. Same goes for PodRuntimeInstance, it only create linux namespaces and do a chroot (I simplified).
Network implementation will be handed by those runtime with a specific trait. The responsability of this trait is to give a contextual implementation of the network. We expect this implementation to only contain two methods for now: up and down, which refer to setup and cleanup of the network. Below is the simpliest trait that can be used. In case you determine more is needed, you can add arguments. The contract defined here won't tell you which IP are available and that's normal, we can easily determine that IP X.X.X.[0|1|254] are used by the provider (0 is the network, 1 is the gateway, 254 is a reserved IP).
impl trait MySuperNetwork {
// IETH is a name of network interface
fn up(network: Ipv4, out_interface: IEth, ip_mask: u16): Result<(), NetworkError>
fn down(): Result<(), NetworkError>
}
What needs to be done ?
This work can be divided into several PRs.
Instance abstraction
[ ] Determine a common contract that is generic enough for both Pod and Function
[ ] Create a factory for both Pod Runtime and Function Runtime
[ ] Determine an Error type that will be used for the defined trait
[ ] Create an implementation to go from RuntimeError to RikletError
Pod Runtime Instance
[ ] Based on created abstraction, move the code of Pod creation into an implementation of the trait
[ ] You should handle errors for each steps
Function Runtime Instance
[ ] Based on created abstraction, move the code of Function creation into an implementation of the trait
[ ] Network implementation should be adapted based on the parallel work done for it
[ ] You should handle errors for each steps
Riklet Core
[ ] Riklet should be using the defined factory and runtime methods to create or delete a workload
[ ] Riklet should handle errors and take simple action in order to alert about it
Context
A lot of work has been done to have something working in RIK, especially in Riklet. Either to run containers or VMs. We'd like to keep things simple and add an abstraction around methods that are deploying workloads. The idea is to create a trait (or more) in order to define an implementation of a runtime based on workload kind (
Function
orPod
).The responsability of those implementation should be kept to deploying the infrastructure to run a workload, this doesn't concern network. For instance,
FunctionRuntimeInstance
is expected to download a rootFS and start the microVM with ability to monitor it. Same goes forPodRuntimeInstance
, it only create linux namespaces and do a chroot (I simplified).Network implementation will be handed by those runtime with a specific trait. The responsability of this trait is to give a contextual implementation of the network. We expect this implementation to only contain two methods for now:
up
anddown
, which refer to setup and cleanup of the network. Below is the simpliest trait that can be used. In case you determine more is needed, you can add arguments. The contract defined here won't tell you which IP are available and that's normal, we can easily determine that IPX.X.X.[0|1|254]
are used by the provider (0
is the network,1
is the gateway,254
is a reserved IP).What needs to be done ?
This work can be divided into several PRs.
RuntimeError
toRikletError