summaryrefslogtreecommitdiffstats
path: root/recipes-networking/cni
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2017-10-02 09:05:54 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-10-02 09:15:58 -0400
commit176715435e67f30e45a84e3789fe8fb1f809f48b (patch)
tree322ae5b774bbce6afe208ac245c47ccdef62d486 /recipes-networking/cni
parent0ff8923f08ae9f7a0e8ec71e4d5a7edb1d027b43 (diff)
downloadmeta-virtualization-176715435e67f30e45a84e3789fe8fb1f809f48b.tar.gz
containers: CNI: introduce container networking interface
Introducing the CNI framework to allow platforms such as kubernetes + cri-o to use thm for networking configuration. The networking plugins are installed, but are not configured by default to create any specific networking interfaces, which are the responsibility of the image and distribution. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-networking/cni')
-rw-r--r--recipes-networking/cni/cni_git.bb93
1 files changed, 93 insertions, 0 deletions
diff --git a/recipes-networking/cni/cni_git.bb b/recipes-networking/cni/cni_git.bb
new file mode 100644
index 00000000..137ce661
--- /dev/null
+++ b/recipes-networking/cni/cni_git.bb
@@ -0,0 +1,93 @@
1HOMEPAGE = "https://github.com/containernetworking/cni"
2SUMMARY = "Container Network Interface - networking for Linux containers"
3DESCRIPTION = "CNI (Container Network Interface), a Cloud Native Computing \
4Foundation project, consists of a specification and libraries for writing \
5plugins to configure network interfaces in Linux containers, along with a \
6number of supported plugins. CNI concerns itself only with network connectivity \
7of containers and removing allocated resources when the container is deleted. \
8Because of this focus, CNI has a wide range of support and the specification \
9is simple to implement. \
10"
11
12SRCREV_cni = "4b9e11a5266fe50222ed00c5973c6ea4a384a4bb"
13SRCREV_plugins = "c238c93b5e7c681f1935ff813b30e82f96f6c367"
14SRC_URI = "\
15 git://github.com/containernetworking/cni.git;nobranch=1;name=cni \
16 git://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=plugins;name=plugins \
17 "
18
19LICENSE = "Apache-2.0"
20LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
21
22GO_IMPORT = "import"
23
24PV = "0.6.0+git${SRCREV_cni}"
25
26inherit go
27inherit goarch
28
29do_compile() {
30 export GOARCH="${TARGET_GOARCH}"
31 export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
32 export GOPATH="${S}/src/import:${S}/src/import/vendor"
33
34 # Pass the needed cflags/ldflags so that cgo
35 # can find the needed headers files and libraries
36 export CGO_ENABLED="1"
37 export CFLAGS=""
38 export LDFLAGS=""
39 export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
40 export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
41
42 # link fixups for compilation
43 rm -f ${S}/src/import/vendor/src
44 ln -sf ./ ${S}/src/import/vendor/src
45 rm -rf ${S}/src/import/plugins
46 rm -rf ${S}/src/import/vendor/github.com/containernetworking/plugins
47
48 mkdir -p ${S}/src/import/vendor/github.com/containernetworking/cni
49
50 ln -sf ../../../../libcni ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
51 ln -sf ../../../../pkg ${S}/src/import/vendor/github.com/containernetworking/cni/pkg
52 ln -sf ../../../../cnitool ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
53 ln -sf ${WORKDIR}/plugins ${S}/src/import/vendor/github.com/containernetworking/plugins
54
55 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
56 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
57
58 # Pass the needed cflags/ldflags so that cgo
59 # can find the needed headers files and libraries
60 export CGO_ENABLED="1"
61 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
62 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
63
64 cd ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
65 go build
66
67 cd ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
68 go build
69
70 cd ${S}/src/import/vendor/github.com/containernetworking/plugins/
71 PLUGINS="plugins/meta/* plugins/main/*"
72 mkdir -p ${WORKDIR}/plugins/bin/
73 for p in $PLUGINS; do
74 plugin="$(basename "$p")"
75 echo "building: $p"
76 go build -o ${WORKDIR}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
77 done
78}
79
80do_install() {
81 localbindir="/usr/local/bin"
82
83 install -d ${D}${localbindir}
84 install -d ${D}/${sysconfdir}/cni/net.d
85
86 install -m 755 ${S}/src/import/cnitool/cnitool ${D}/${localbindir}
87 install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir}
88}
89
90FILES_${PN} += "/usr/local/bin/*"
91
92INHIBIT_PACKAGE_STRIP = "1"
93INSANE_SKIP_${PN} += "ldflags already-stripped"