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

[RFC] Implement a runtime interface v2 for both containerd and cri-o #907

@sboeuf

Description

@sboeuf

Problem statement

Recently, containerd defined a new interface called containerd-shim-v2. The main goal for this new interface is to make sure that no assumption is based on the PID of the container processes. This way, it allows for a way better support of VM based container runtimes such as Kata Containers.
We currently have a PR in flight to support this interface: #572
One thing to notice that will help to understand the problem statement is that containerd-shim-v2 is a gRPC interface that expects the implementation to be defined through a gRPC server.
The introduction of this new API is a real step forward in making VM based container runtimes first class citizens in the container ecosystem, and I think we're all excited about that.

However, I have one concern regarding the burden maintenance on the long term between different solutions out there. By that, I mean that I would expect that we could progressively lower the maintenance on the kata-runtime CLI, and eventually deprecate it since the containerd-shim-v2 interface is a better fit for VM based runtimes.
Unfortunately, this logic does not work if all the players in the ecosystem don't rely on such interface, but instead stick to the runc CLI one. And here I'm thinking about CRI-O, which is the other CRI implementation widely used to run Kata Containers.

That's why we've started some discussion with CRI-O maintainers (/cc @runcom @mrunalp) in order to fill this gap and get a better support for VM based runtimes through CRI-O too.

Difference between CRI-O and containerd

CRI-O maintainers agree with the need for such interface and they are more than happy to move into this direction rather sooner than later.
There's only one point where they would like something different than what has been introduced by containerd, the gRPC server. Indeed, adding a gRPC protocol brings a clear abstraction layer, but it brings some memory footprint increase due to the extra process running one server per sandbox. Another argument mentioned was the complexity to debug issues when too many gRPC layers are involved when looking at the full stack.

Based on this, we don't want to diverge by implementing one interface for CRI-O and another for containerd, otherwise we would get back to the initial problem of maintaining several code bases according to the interface being used.

Proposal

That's why I thought we could try to define a standard interface, something that would not be specific to containerd or CRI-O, but that both could rely on.

From containerd perspective

containerd-shim-v2 interface would be a simple gRPC wrapper on top of this new interface. This wrapper would be specific to containerd-shim-v2, and would implement only the gRPC server logic.

From CRI-O perspective

CRI-O would rely directly on this interface, and in order to avoid the usage of any client/sever model, it would import this interface definition from a standard package, and it would use Kata Containers implementation as a shared library implementing this interface. This kata_runtime_api_v2.so would be provided through the CRI-O configuration file, and could be different depending on the chosen runtime (relying on RuntimeClass).

More thoughts

This API needs to be defined carefully by making sure it receives the right information/parameters through every function call.
Moreover, I think this new API should assume being run by a long running process, this way the implementation can easily assume that it will be able to retrieve the pointers it needs, without recreating in-memory data from scratch (reading from disk basically).

An ASCII diagram to clarify :)

+----------------------+                 +-----------------------+
|                      |                 |                       |
|      containerd      |                 |         cri-o         |
|                      |                 |                       |
+----------+-----------+                 +-----------+-----------+
           |                                         |
           |                                         |
+----------v-----------+                             |
|  containerd-shim-v2  |                             |
|      gRPC server     |                             |
|                      |                             |
+----------+-----------+                             |
           |                                         |
           |                                         |
+----------v-----------------------------------------v-----------+
|                                                                |
|                    Container runtime API v2                    |
|                                                                |
+-------------------------------+--------------------------------+
                                |
                                |
                                |
+-------------------------------v--------------------------------+
|                                                                |
|                       Kata Containers API                      |
|                                                                |
+----------------------------------------------------------------+

Here is a link to a google doc where we started this conversation and how we could achieve this.

Feedback? Questions?

/cc @egernst @sameo @mcastelino @amshinde @grahamwhaley @jodh-intel @bergwolf @lifupan @gnawux @WeiZhang555 @jon @mrunalp @runcom @crosbymichael @Random-Liu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions