Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abstraction level around runtimes (containers/VMs) #56

Closed
11 tasks
alexandrebrg opened this issue Mar 19, 2023 · 0 comments · Fixed by #47
Closed
11 tasks

Add abstraction level around runtimes (containers/VMs) #56

alexandrebrg opened this issue Mar 19, 2023 · 0 comments · Fixed by #47
Assignees
Labels
scope/riklet type/enhancement New feature or request

Comments

@alexandrebrg
Copy link
Member

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 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
@alexandrebrg alexandrebrg moved this to 🏗️ In Progress in RIK Tracking Mar 19, 2023
@alexandrebrg alexandrebrg linked a pull request Mar 19, 2023 that will close this issue
@alexandrebrg alexandrebrg changed the title [riklet] Add abstraction level around runtimes (containers/VMs) Add abstraction level around runtimes (containers/VMs) Mar 28, 2023
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Done in RIK Tracking Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope/riklet type/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants