Skip to content

Conversation

@laijs
Copy link
Contributor

@laijs laijs commented Oct 13, 2015

In numerous cases, we need to share the container's namespace with
an existing container. In these cases, we have to resolve the namespace
file step by step. For example, the docker resolves it from the
information of the target container in several steps and saves it to the
config (now it is in-memory config, it will be runtime.json in future).
We can move the resolving operation to the oci implementations
and allow the namespace path to be container ID in the spec.

Reasons:

  • it really repsents "sharing the namespace with existing container".
    (it is the most important reason.)
  • the administrator writes the runtime.json much conveniently and
    less error. And it is better readability and the administrator
    is easier to check the runtime.json which is written by himself
    or by other human or by other tools.
  • we may have more orchestra tools than oci implementations,
    the resolving operation is better in implementations than
    in the tools.

Signed-off-by: Lai Jiangshan [email protected]

In numerous cases, we need to share the container's namespace with
an existing container. In these cases, we have to resolve the namespace
file step by step. For example, the docker resolves it from the
information of the target container in several steps and saves it to the
config (now it is in-memory config, it will be runtime.json in future).
We can move the resolving operation to the oci implementations
and allow the namespace path to be container ID in the spec.

Reasons:
0) it really repsents "sharing the namespace with existing container".
   (it is the most important reason.)
1) the administrator writes the runtime.json much conveniently and
   less error. And it is better readability and the administrator
   is easier to check the runtime.json which is written by himself
   or by other human or by other tools.
2) we may have more orchestra tools than oci implementations,
   the resolving operation is better in implementations than
   in the tools.

Signed-off-by: Lai Jiangshan <[email protected]>
@philips
Copy link
Contributor

philips commented Oct 14, 2015

I really don't want to have magic resolution in the runtime.json like this. If we consider this feature we should have the runtime resolve the naming.

@wking
Copy link
Contributor

wking commented Oct 15, 2015

This sounds useful, but I'd turn it around. Instead of making it a
lookup-time thing, you could make it creation-time thing with a
pre-start hook like:

#!/bin/sh
STATE=$(cat) &&
PID=$(echo "${STATE}" | jq -r .pid) &&
ID=$(echo "${STATE}" | jq -r .id) &&
DIR="/run/opencontainer/containers/${ID}/ns" &&
mkdir "${DIR}" &&
for NAMESPACE_PATH in "/proc/${PID}/ns/"*
do
NAMESPACE=$(basename "${NAMESPACE_PATH}") &&
touch "${DIR}/${NAMESPACE}" &&
mount --bind "${NAMESPACE_PATH}" "${DIR}/${NAMESPACE}"
done

Then you could use:

"path": "/run/opencontainer/containers/{container-id}/ns/{namespace}"

in another container's runtime.json to join any of the initial
container's namespaces.

@mrunalp
Copy link
Contributor

mrunalp commented Oct 15, 2015

@laijs I agree with @philips. This sounds like a problem that can be solved using higher level tooling that generates the correct values in your runtime.json

@crosbymichael
Copy link
Member

Ok, lets close this one seeing that higher level tooling can generate these paths based on container IDs

@wking
Copy link
Contributor

wking commented Oct 23, 2015

On Thu, Oct 22, 2015 at 04:16:29PM -0700, Michael Crosby wrote:

Ok, lets close this one seeing that higher level tooling can
generate these paths based on container IDs

We should probably start collecting a list of these punted features,
so we can point people at a single document for out-of-scope features
(ideally with pointers to the higher-level tooling that covers that
use-case). I'm happy to write up something along those lines if that
sounds useful, just tell me where you want it.

@wking wking mentioned this pull request Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants