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

virtcontainers code base is monolithic #1059

Closed
3 of 8 tasks
sameo opened this issue Dec 19, 2018 · 7 comments
Closed
3 of 8 tasks

virtcontainers code base is monolithic #1059

sameo opened this issue Dec 19, 2018 · 7 comments
Assignees

Comments

@sameo
Copy link

sameo commented Dec 19, 2018

Description of problem

virtcontainers was built and designed around the idea of defining virtualized container modules and use them to configure a hardware virtualization based container runtime. Those modules were:

  • Hypervisors
  • Shims
  • Agents
  • Proxies
  • Storage
  • Networking

As a result, one would expect the virtcontainers code to be logically split into different internal packages implementing those modules. Instead, it is mostly flat and monolithic. Most of those modules are living under the virtcontainers package.

Why should we care?

Architecture flexibility and cleanliness

Living under one single package allows us to build hard dependencies between those modules. We can avoid building clean and agnostic APIs between those modules because we're part of the same golang package.
For example, there is no reason why the hypervisor code should depend on some state storage (resourceStorage) definitions. Hypervisor implementations could call into a separated state storage API if they feel they need to, but the hypervisor interface should not depend on it.

In general, we want to make the virtcontainers simpler and more flexible. While enabling the Firecracker hypervisor, we realized how difficult it could be to support a VMM that does not follow the QEMU lifecycle. Forcing ourselves into cleanly separating the code into independent packages would provide the virtcontainers code with more flexibility for supporting those use cases.

Code maintenance

Building independent internal packages would make the code easier to maintain. It would break the number of dependencies between different modules and would allow for a more fine grained maintenance between modules and their test cases.

This would make the code also easier to approach. Getting back to it after roughly a 6 months break showed how difficult it could be for a first comer to understand and contribute to this piece of software. Modularizing it will hopefully make the virtcontainers learning curve a little less steep.

Complexity reduction

As our support matrix has grown over the past months, the code complexity has grown as well. Splitting it into separate modules should make it less complex and better prepared for the 2.0 overall simplification.

Proposed plan

This is a long term task, and at the same time virtcontainers is a stable code base. We want to make iterative changes to it and add move code into their own modules, one module at a time.

The plan below will get updated as we move forward.
I propose that our first iteration should create the following internal packages. We will add issues to track to each of those items.

@sameo sameo self-assigned this Dec 19, 2018
@sameo
Copy link
Author

sameo commented Dec 19, 2018

@gnawux
Copy link
Member

gnawux commented Dec 19, 2018

@sameo I agree with the idea in general. By the way, for the hypervisor part, could we move the govmm functions, i.e. the qemu wrapping, to kata-runtime. It increases the maintenance cost much for qemu related stuff.

@bergwolf
Copy link
Member

Yeah, this is something we've been talking several times and I really like to see it happening!

@WeiZhang555
Copy link
Member

+1 !

OMG, I'm sooooooo happy that this is finally happening, I've mentioned this so many times...Let's do it!

@WeiZhang555
Copy link
Member

PR #888 is doing the shim rework, I marked it in the checkbox table above

sameo pushed a commit to sameo/runtime-1 that referenced this issue Jan 25, 2019
In order to fix kata-containers#1059, we want to create a hypervisor package. Some of
the hypervisor implementations (qemu) depend on the network and endpoint
interfaces. We can not have a virtcontainers -> hypervisor -> network,
endpoint -> virtcontainers cyclic dependency.
So before creating the hypervisor package, we need to decouple the
network API from the virtcontainers one.

Fixes: kata-containers#1180

Signed-off-by: Samuel Ortiz <[email protected]>
sameo pushed a commit to sameo/runtime-1 that referenced this issue Jan 25, 2019
In order to fix kata-containers#1059, we want to create a hypervisor package. Some of
the hypervisor implementations (qemu) depend on the network and endpoint
interfaces. We can not have a virtcontainers -> hypervisor -> network,
endpoint -> virtcontainers cyclic dependency.
So before creating the hypervisor package, we need to decouple the
network API from the virtcontainers one.

Fixes: kata-containers#1180

Signed-off-by: Samuel Ortiz <[email protected]>
sameo pushed a commit to sameo/runtime-1 that referenced this issue Jan 28, 2019
In order to fix kata-containers#1059, we want to create a hypervisor package. Some of
the hypervisor implementations (qemu) depend on the network and endpoint
interfaces. We can not have a virtcontainers -> hypervisor -> network,
endpoint -> virtcontainers cyclic dependency.
So before creating the hypervisor package, we need to decouple the
network API from the virtcontainers one.

Fixes: kata-containers#1180

Signed-off-by: Samuel Ortiz <[email protected]>
@sameo
Copy link
Author

sameo commented Jan 31, 2019

Not done yet. Far from it :-/

@sameo sameo reopened this Jan 31, 2019
@sameo
Copy link
Author

sameo commented Feb 12, 2019

Store package merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants