[meta-virtualization] [PATCH 5/6] cni: move cni tools to /usr/lib/cni

Stefan Agner stefan at agner.ch
Mon Sep 9 14:36:54 PDT 2019


On 2019-09-06 14:42, Bruce Ashfield wrote:
> On Fri, Sep 6, 2019 at 8:07 AM Stefan Agner <stefan at agner.ch> wrote:
>>
>> On 2019-09-03 19:28, Bruce Ashfield wrote:
>> > On Sun, Sep 1, 2019 at 9:33 PM ChenQi <Qi.Chen at windriver.com> wrote:
>> >>
>> >> On 09/02/2019 04:33 AM, Stefan Agner wrote:
>> >> > From: Stefan Agner <stefan.agner at toradex.com>
>> >> >
>> >> > Use a standard location to store the cni tools and plugins. This
>> >> > is more in line how other distributions package cni.
>> >>
>> >> But from what I see, at least Fedora and Ubuntu are using /opt/cni/bin
>> >> directory.
>>
>> Fedora uses /usr/libexec/cni:
>> https://koji.fedoraproject.org/koji/rpminfo?rpmID=18850786
>>
>> As far as I can tell there is no upstream Debian/Ubuntu package for this
>> yet.
>>
>> Arch Linux uses /usr/lib/cni:
>> https://www.archlinux.org/packages/community/x86_64/cni-plugins/
>>
>> I haven't seen distribution typically use /opt.
>>
>> >> Also, have you tested such change with simple k8s setup which makes use
>> >> of these plugins? E.g. flannel?
>>
>> I haven't. In fact I am not familiar with k8s setups, so this would need
>> me some time to understand and test...
> 
> Indeed. It isn't easy to setup and test, so don't worry about it.
> 
> But I can say, the reason that the recipe installs to /opt/cni/bin is
> that there are many parts of k8s that do expect the cni binaries to be
> there. I did a quick search this morning, and that expectation is
> still the case. So there may be a disconnect from standalone distro
> packaged cni components, and k8s specific things.  Plus it isn't just
> k8s managed cni plugins that go into that directory, there are
> instructions for installing unmanaged ones to that same location.
> 
> So to avoid breaking those large software stacks, we do need to keep
> /opt/cni/bin around at some level.
> 
>>
>> >
>> > Indeed. I haven't seen anything that looks like a standard location
>> > for these. I'd be interested to hear how testing went.
>> >
>> > Is this something that we can make configurable ? That would be my
>> > preference, that way we can be sure to not break anyone's use case.
>>
>> I guess one always can do a bbappend...?
>>
>> I don't think that we can configure at runtime (E.g. have the package
>> manager install it into different location depending on...)
> 
> I was more thinking at build time. Have a packageconfig value, and
> just have the CNI package grab files from both directories. That way a
> bbappend would just be a packageconfig setting, and nothing more
> extensive than that.
> 
> Alternatively, we could symlink one directory to the other, so they
> could be found in either location.

I kinda like this alternative better. Will try this approach in v2.

--
Stefan

> 
> Bruce
> 
>>
>> --
>> Stefan
>>
>>
>> >
>> > Bruce
>> >
>> >>
>> >> Best Regards,
>> >> Chen Qi
>> >>
>> >> > Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
>> >> > ---
>> >> >   recipes-containers/cri-o/files/crio.conf | 2 +-
>> >> >   recipes-networking/cni/cni_git.bb        | 4 ++--
>> >> >   2 files changed, 3 insertions(+), 3 deletions(-)
>> >> >
>> >> > diff --git a/recipes-containers/cri-o/files/crio.conf b/recipes-containers/cri-o/files/crio.conf
>> >> > index 51d7f40..dd22465 100644
>> >> > --- a/recipes-containers/cri-o/files/crio.conf
>> >> > +++ b/recipes-containers/cri-o/files/crio.conf
>> >> > @@ -144,4 +144,4 @@ registries = [
>> >> >   network_dir = "/etc/cni/net.d/"
>> >> >
>> >> >   # plugin_dir is is where CNI plugin binaries are stored.
>> >> > -plugin_dir = "/opt/cni/bin/"
>> >> > +plugin_dir = "/usr/lib/cni/"
>> >> > diff --git a/recipes-networking/cni/cni_git.bb b/recipes-networking/cni/cni_git.bb
>> >> > index 5348b95..86e5e0f 100644
>> >> > --- a/recipes-networking/cni/cni_git.bb
>> >> > +++ b/recipes-networking/cni/cni_git.bb
>> >> > @@ -63,7 +63,7 @@ do_compile() {
>> >> >   }
>> >> >
>> >> >   do_install() {
>> >> > -    localbindir="/opt/cni/bin"
>> >> > +    localbindir="${libdir}/cni/"
>> >> >
>> >> >       install -d ${D}${localbindir}
>> >> >       install -d ${D}/${sysconfdir}/cni/net.d
>> >> > @@ -72,7 +72,7 @@ do_install() {
>> >> >       install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir}
>> >> >   }
>> >> >
>> >> > -FILES_${PN} += "/opt/cni/bin/*"
>> >> > +FILES_${PN} += "${libdir}/cni/*"
>> >> >
>> >> >   INSANE_SKIP_${PN} += "ldflags already-stripped"
>> >> >
>> >>
>> >>
>> >> --
>> >> _______________________________________________
>> >> meta-virtualization mailing list
>> >> meta-virtualization at yoctoproject.org
>> >> https://lists.yoctoproject.org/listinfo/meta-virtualization
>> >
>> >
>> >
>> > --
>> > - Thou shalt not follow the NULL pointer, for chaos and madness await
>> > thee at its end
>> > - "Use the force Harry" - Gandalf, Star Trek II


More information about the meta-virtualization mailing list