Giter Site home page Giter Site logo

Comments (8)

jonboulle avatar jonboulle commented on July 17, 2024

I don't really follow; why does the plugin need anything other than the absolute path?

from cni.

jonboulle avatar jonboulle commented on July 17, 2024

I mean, in rkt we DO pass an absoluteCNI_NETNS as far as I can tell - where are you seeing the logic you referenced?

from cni.

luke-mino-altherr avatar luke-mino-altherr commented on July 17, 2024

I have not dug into the rkt code myself, but the testing I've done with rkt v0.9.0 shows that rkt still passes in the relative CNI_NETNS path. I wrote up a simple plugin to show this:

luke@test-master:~/rkt-v0.9.0$ cat > 10-test.conf <<EOF
{
    "name": "test",
    "type": "test-rkt"
}
EOF
luke@test-master:~/rkt-v0.9.0$ sudo mv 10-test.conf /etc/rkt/net.d/
luke@test-master:~/rkt-v0.9.0$ cat > test-rkt <<EOF
#!/bin/bash

echo \$CNI_NETNS > ~/netns.txt
EOF
luke@test-master:~/rkt-v0.9.0$ chmod +x test-rkt; sudo mv test-rkt /usr/lib/rkt/plugins/net/
luke@test-master:~/rkt-v0.9.0$ sudo ./rkt run docker://busybox --net=test
luke@test-master:~/rkt-v0.9.0$ cat ~/netns.txt
netns

from cni.

eyakubovich avatar eyakubovich commented on July 17, 2024

We can require absolute path but the plugin can also just $(pwd)/$CNI_NETNS to get the full path.

from cni.

Symmetric avatar Symmetric commented on July 17, 2024

The latter approach seems to preclude using namespaces of the form /proc/<pid>/ns/net, which is what we want to do in our Kubernetes plugin. I think that means that passing an absolute path is more flexible.

from cni.

eyakubovich avatar eyakubovich commented on July 17, 2024

Why does it preclude the use of relative path? I mean, if the cwd is /proc/<pid>, then yes, ns/net would be a bad path. If it was /var/lib/mycontainer, ../../../proc/<pid>/ns/net would be fine. Obviously the container runtime has to ensure that the path it provides makes sense when the plugin is executed. But the plugin can just expect any path, relative or absolute, and can make a relative into absolute easily.

I mean all normal Unix commands work fine with both. You can do ls ./foo/ and ls /home/me/foo.

from cni.

caseydavenport avatar caseydavenport commented on July 17, 2024

I tested this out - it looks like rkt does pass the correct path relative to the cwd of the plugin, so I think this is fine. If anything, I think the CNI_NETNS variable should just be documented to include that it can either be an absolute path, or a path relative to the current working directory of the plugin.

Either way, I think this issue can be closed.

from cni.

steveej avatar steveej commented on July 17, 2024

I mean all normal Unix commands work fine with both. You can do ls ./foo/ and ls /home/me/foo.

This is my general understanding too, and the CNI plugins are no exception.

Either way, I think this issue can be closed.

Agreed.

from cni.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.