On 08/13/2019 08:34 PM, Bruce Ashfield wrote:


On Tue, Aug 13, 2019 at 3:52 AM Chen Qi <[email protected] <mailto:[email protected]>> wrote:

    Extract common settings of two cni recipe into cni.inc.
    Add comment in recipe file to explicitly state what the version is
    for.
    More sepcifically, the git version is used to track latest upstream,
    while the 0.7.1 version is used to ensure basic setup works for k8s.


As I mentioned, we won't do this. It doubles the maintenance and shows a fundamental API / ABI incompatibility if we can't use the different versions against a released k8s.

There is one version of the recipe, and I've always had it working for the released kubernetes and master. I'm not seeing any issues with the latest and my k8s configs, so I'm not sure what you are running into that I'm not.

Bruce


I've filed an issue for upstream. https://github.com/containernetworking/plugins/issues/370#issuecomment-520718048
Please check it.

How do you setup you k8s cluster? Are you using flannel?
I can confirm that the current versions in meta-virtualization would result in "failed to create bridge "cni0": could not add "cni0": operation not supported" error. This can be reproduced on both virtual machines and physical machines.

Execute the following commands on target, and you should see the coredns is not running, and when describing the pod, you see the failure.
swapoff -a
kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Please help double check if this could be reproduced on your side.

Best Regards,
Chen Qi


    Signed-off-by: Chen Qi <[email protected]
    <mailto:[email protected]>>
    ---
     recipes-networking/cni/cni.inc      | 79
    +++++++++++++++++++++++++++++
     recipes-networking/cni/cni_0.7.1.bb <http://cni_0.7.1.bb> | 71
    +-------------------------
     recipes-networking/cni/cni_git.bb <http://cni_git.bb>  | 73
    +-------------------------
     3 files changed, 83 insertions(+), 140 deletions(-)
     create mode 100644 recipes-networking/cni/cni.inc

    diff --git a/recipes-networking/cni/cni.inc
    b/recipes-networking/cni/cni.inc
    new file mode 100644
    index 0000000..7a3b87f
    --- /dev/null
    +++ b/recipes-networking/cni/cni.inc
    @@ -0,0 +1,79 @@
    +HOMEPAGE = "https://github.com/containernetworking/cni";
    +SUMMARY = "Container Network Interface - networking for Linux
    containers"
    +DESCRIPTION = "CNI (Container Network Interface), a Cloud Native
    Computing \
    +Foundation project, consists of a specification and libraries for
    writing \
    +plugins to configure network interfaces in Linux containers,
    along with a \
    +number of supported plugins. CNI concerns itself only with
    network connectivity \
    +of containers and removing allocated resources when the container
    is deleted. \
    +Because of this focus, CNI has a wide range of support and the
    specification \
    +is simple to implement. \
    +"
    +
    +# 0.7.1
    +SRCREV_cni = "4cfb7b568922a3c79a23e438dc52fe537fc9687e"
    +# 0.7.5
    +SRCREV_plugins = "a62711a5da7a2dc2eb93eac47e103738ad923fd6"
    +SRC_URI = "\
+ git://github.com/containernetworking/cni.git;branch=master;name=cni
    <http://github.com/containernetworking/cni.git;branch=master;name=cni>
    \
+ git://github.com/containernetworking/plugins.git;branch=v0.7;destsuffix=plugins;name=plugins
    
<http://github.com/containernetworking/plugins.git;branch=v0.7;destsuffix=plugins;name=plugins>
    \
    +       "
    +
    +RPROVIDES_${PN} += "kubernetes-cni"
    +
    +LICENSE = "Apache-2.0"
    +LIC_FILES_CHKSUM =
    "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
    +
    +GO_IMPORT = "import"
    +
    +PV = "0.7.1"
    +
    +inherit go
    +inherit goarch
    +
    +do_compile() {
    +       # link fixups for compilation
    +       rm -f ${S}/src/import/vendor/src
    +       mkdir -p ${S}/src/import/vendor/
    +       ln -sf ./ ${S}/src/import/vendor/src
    +       rm -rf ${S}/src/import/plugins
    +       rm -rf
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    +
    +       mkdir -p
    ${S}/src/import/vendor/github.com/containernetworking/cni
    <http://github.com/containernetworking/cni>
    +
    +       ln -sf ../../../../libcni
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    +       ln -sf ../../../../pkg
    ${S}/src/import/vendor/github.com/containernetworking/cni/pkg
    <http://github.com/containernetworking/cni/pkg>
    +       ln -sf ../../../../cnitool
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    +       ln -sf ${WORKDIR}/plugins
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    +
    +       export
    
GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
    +       export CGO_ENABLED="1"
    +
    +       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    +       ${GO} build
    +
    +       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    +       ${GO} build
    +
    +       cd
    ${S}/src/import/vendor/github.com/containernetworking/plugins/
    <http://github.com/containernetworking/plugins/>
    +       PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls
    -d plugins/main/* | grep -v windows)"
    +       mkdir -p ${WORKDIR}/plugins/bin/
    +       for p in $PLUGINS; do
    +           plugin="$(basename "$p")"
    +           echo "building: $p"
    +           ${GO} build -o ${WORKDIR}/plugins/bin/$plugin
    github.com/containernetworking/plugins/$p
    <http://github.com/containernetworking/plugins/$p>
    +       done
    +}
    +
    +do_install() {
    +    localbindir="/opt/cni/bin"
    +
    +    install -d ${D}${localbindir}
    +    install -d ${D}/${sysconfdir}/cni/net.d
    +
    +    install -m 755 ${S}/src/import/cnitool/cnitool
    ${D}/${localbindir}
    +    install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir}
    +}
    +
    +FILES_${PN} += "/opt/cni/bin/*"
    +
    +INSANE_SKIP_${PN} += "ldflags already-stripped"
    diff --git a/recipes-networking/cni/cni_0.7.1.bb
    <http://cni_0.7.1.bb> b/recipes-networking/cni/cni_0.7.1.bb
    <http://cni_0.7.1.bb>
    index 7a3b87f..7977040 100644
    --- a/recipes-networking/cni/cni_0.7.1.bb <http://cni_0.7.1.bb>
    +++ b/recipes-networking/cni/cni_0.7.1.bb <http://cni_0.7.1.bb>
    @@ -1,13 +1,5 @@
    -HOMEPAGE = "https://github.com/containernetworking/cni";
    -SUMMARY = "Container Network Interface - networking for Linux
    containers"
    -DESCRIPTION = "CNI (Container Network Interface), a Cloud Native
    Computing \
    -Foundation project, consists of a specification and libraries for
    writing \
    -plugins to configure network interfaces in Linux containers,
    along with a \
    -number of supported plugins. CNI concerns itself only with
    network connectivity \
    -of containers and removing allocated resources when the container
    is deleted. \
    -Because of this focus, CNI has a wide range of support and the
    specification \
    -is simple to implement. \
    -"
    +# This cni version is here to ensure that basic k8s setup with
    flannel could work.
    +require cni.inc

     # 0.7.1
     SRCREV_cni = "4cfb7b568922a3c79a23e438dc52fe537fc9687e"
    @@ -17,63 +9,4 @@ SRC_URI = "\
git://github.com/containernetworking/cni.git;branch=master;name=cni
    <http://github.com/containernetworking/cni.git;branch=master;name=cni>
    \
git://github.com/containernetworking/plugins.git;branch=v0.7;destsuffix=plugins;name=plugins
    
<http://github.com/containernetworking/plugins.git;branch=v0.7;destsuffix=plugins;name=plugins>
    \
            "
    -
    -RPROVIDES_${PN} += "kubernetes-cni"
    -
    -LICENSE = "Apache-2.0"
    -LIC_FILES_CHKSUM =
    "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
    -
    -GO_IMPORT = "import"
    -
     PV = "0.7.1"
    -
    -inherit go
    -inherit goarch
    -
    -do_compile() {
    -       # link fixups for compilation
    -       rm -f ${S}/src/import/vendor/src
    -       mkdir -p ${S}/src/import/vendor/
    -       ln -sf ./ ${S}/src/import/vendor/src
    -       rm -rf ${S}/src/import/plugins
    -       rm -rf
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    -
    -       mkdir -p
    ${S}/src/import/vendor/github.com/containernetworking/cni
    <http://github.com/containernetworking/cni>
    -
    -       ln -sf ../../../../libcni
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    -       ln -sf ../../../../pkg
    ${S}/src/import/vendor/github.com/containernetworking/cni/pkg
    <http://github.com/containernetworking/cni/pkg>
    -       ln -sf ../../../../cnitool
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    -       ln -sf ${WORKDIR}/plugins
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    -
    -       export
    
GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
    -       export CGO_ENABLED="1"
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    -       ${GO} build
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    -       ${GO} build
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/plugins/
    <http://github.com/containernetworking/plugins/>
    -       PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls
    -d plugins/main/* | grep -v windows)"
    -       mkdir -p ${WORKDIR}/plugins/bin/
    -       for p in $PLUGINS; do
    -           plugin="$(basename "$p")"
    -           echo "building: $p"
    -           ${GO} build -o ${WORKDIR}/plugins/bin/$plugin
    github.com/containernetworking/plugins/$p
    <http://github.com/containernetworking/plugins/$p>
    -       done
    -}
    -
    -do_install() {
    -    localbindir="/opt/cni/bin"
    -
    -    install -d ${D}${localbindir}
    -    install -d ${D}/${sysconfdir}/cni/net.d
    -
    -    install -m 755 ${S}/src/import/cnitool/cnitool
    ${D}/${localbindir}
    -    install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir}
    -}
    -
    -FILES_${PN} += "/opt/cni/bin/*"
    -
    -INSANE_SKIP_${PN} += "ldflags already-stripped"
    diff --git a/recipes-networking/cni/cni_git.bb <http://cni_git.bb>
    b/recipes-networking/cni/cni_git.bb <http://cni_git.bb>
    index 5348b95..06b37a4 100644
    --- a/recipes-networking/cni/cni_git.bb <http://cni_git.bb>
    +++ b/recipes-networking/cni/cni_git.bb <http://cni_git.bb>
    @@ -1,13 +1,5 @@
    -HOMEPAGE = "https://github.com/containernetworking/cni";
    -SUMMARY = "Container Network Interface - networking for Linux
    containers"
    -DESCRIPTION = "CNI (Container Network Interface), a Cloud Native
    Computing \
    -Foundation project, consists of a specification and libraries for
    writing \
    -plugins to configure network interfaces in Linux containers,
    along with a \
    -number of supported plugins. CNI concerns itself only with
    network connectivity \
    -of containers and removing allocated resources when the container
    is deleted. \
    -Because of this focus, CNI has a wide range of support and the
    specification \
    -is simple to implement. \
    -"
    +# This cni version is supposed to track latest upstream.
    +require cni.inc

     SRCREV_cni = "dc71cd2ba60c452c56a0a259f2a23d2afe42b688"
     SRCREV_plugins = "0eddc554c0747200b7b112ce5322dcfa525298cf"
    @@ -15,65 +7,4 @@ SRC_URI = "\
git://github.com/containernetworking/cni.git;nobranch=1;name=cni
    <http://github.com/containernetworking/cni.git;nobranch=1;name=cni> \
git://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=plugins;name=plugins
    
<http://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=plugins;name=plugins>
    \
            "
    -
    -RPROVIDES_${PN} += "kubernetes-cni"
    -
    -LICENSE = "Apache-2.0"
    -LIC_FILES_CHKSUM =
    "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
    -
    -GO_IMPORT = "import"
    -
     PV = "0.7.0+git${SRCREV_cni}"
    -
    -inherit go
    -inherit goarch
    -
    -do_compile() {
    -       # link fixups for compilation
    -       rm -f ${S}/src/import/vendor/src
    -       mkdir -p ${S}/src/import/vendor/
    -       ln -sf ./ ${S}/src/import/vendor/src
    -       rm -rf ${S}/src/import/plugins
    -       rm -rf
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    -
    -       mkdir -p
    ${S}/src/import/vendor/github.com/containernetworking/cni
    <http://github.com/containernetworking/cni>
    -
    -       ln -sf ../../../../libcni
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    -       ln -sf ../../../../pkg
    ${S}/src/import/vendor/github.com/containernetworking/cni/pkg
    <http://github.com/containernetworking/cni/pkg>
    -       ln -sf ../../../../cnitool
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    -       ln -sf ${WORKDIR}/plugins
    ${S}/src/import/vendor/github.com/containernetworking/plugins
    <http://github.com/containernetworking/plugins>
    -
    -       export
    
GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
    -       export CGO_ENABLED="1"
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
    <http://github.com/containernetworking/cni/libcni>
    -       ${GO} build
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
    <http://github.com/containernetworking/cni/cnitool>
    -       ${GO} build
    -
    -       cd
    ${S}/src/import/vendor/github.com/containernetworking/plugins/
    <http://github.com/containernetworking/plugins/>
    -       PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls
    -d plugins/main/* | grep -v windows)"
    -       mkdir -p ${WORKDIR}/plugins/bin/
    -       for p in $PLUGINS; do
    -           plugin="$(basename "$p")"
    -           echo "building: $p"
    -           ${GO} build -o ${WORKDIR}/plugins/bin/$plugin
    github.com/containernetworking/plugins/$p
    <http://github.com/containernetworking/plugins/$p>
    -       done
    -}
    -
    -do_install() {
    -    localbindir="/opt/cni/bin"
    -
    -    install -d ${D}${localbindir}
    -    install -d ${D}/${sysconfdir}/cni/net.d
    -
    -    install -m 755 ${S}/src/import/cnitool/cnitool
    ${D}/${localbindir}
    -    install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir}
    -}
    -
    -FILES_${PN} += "/opt/cni/bin/*"
    -
    -INSANE_SKIP_${PN} += "ldflags already-stripped"
    -
    -deltask compile_ptest_base
-- 2.17.1

-- _______________________________________________
    meta-virtualization mailing list
    [email protected]
    <mailto:[email protected]>
    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


-- 
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Reply via email to