hyperhq / runv

Hypervisor-based Runtime for OCI
Apache License 2.0
826 stars 129 forks source link

POD support: Use ns-listerner pid as containers' pid #316

Closed WeiZhang555 closed 8 years ago

WeiZhang555 commented 8 years ago

For the sake of K8S integration, we must have a mechanism to create a pod and allow to integrate with CNI network plugins.

As CNI plugins are operating on nslistener namespaces, we should set pid of nslistener as container's init pid, so that when we insert a NIC into the "fake" namespace, the VM can get notifications.

Signed-off-by: Zhang Wei zhangwei555@huawei.com

WeiZhang555 commented 8 years ago

From now on, runv can support "POD"again. To compose a POD, you need to run something like:

# docker run -tid --name test1 busybox sh
# docker run -tid --net container:test1 busybox sh   // composing a pod

Note that only --net can making a POD, --ipc container:xxx, --pid container:xxx will be ignored.

Using docker top to check two containers in one pod, you will get result like this:

$ docker top 2db792e747a3
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                23612               23416               0                   14:13               pts/24              00:00:00            containerd-nslistener
$ docker top 448783d97d38
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                23612               23416               0                   14:13               pts/24              00:00:00            containerd-nslistener
WeiZhang555 commented 8 years ago

The test case failed because log is too long, I think you should disable debug flag for hyperd test cases.

WeiZhang555 commented 8 years ago

Updated.