summaryrefslogtreecommitdiffstats
path: root/recipes-containers/cri-tools
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2021-02-10 10:09:25 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2021-02-10 10:09:25 -0500
commit2a919ae202f659411a8142d3d95bee4c5314fc74 (patch)
treef67893a2c67591ea97a4b6e9f6f253f93070df09 /recipes-containers/cri-tools
parent4ede0acf4450715ea11c3000bd0cbea0bc6b0f49 (diff)
downloadmeta-virtualization-2a919ae202f659411a8142d3d95bee4c5314fc74.tar.gz
cri: introduce cri-tools
Based on the original recipe from Tim Orling, we introduce a recipe for critools so we can interact diretly with cri based runtimes. We do the normal go manipulations to get this cross building, with the following specific tweak/patch: The build system already knows whether or not we want to use CGO, so we remove the hardcoded variant so our exported environment variable will control the enablement. Since our oe-core go infrastructure insists on both -pie and static builds (for the most part), and that is not recommended by many packages, we end up with errors like: 1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75/src/import/_output/crictl \ -ldflags '-X github.com/kubernetes-sigs/cri-tools/pkg/version.Version=1.20.0' \ -tags '' \ github.com/kubernetes-sigs/cri-tools/cmd/crictl # github.com/kubernetes-sigs/cri-tools/cmd/crictl cannot find package runtime/cgo (using -importcfg) /work/cortexa72-poky-linux/cri-tools/1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75-r0/recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link: cannot open file : open : no such file or directory In a similar manner to: https://www.yoctoproject.org/pipermail/meta-virtualization/2019-March/004084.html We introduce '-a -pkgdir dontusecurrentpkgs' to mask/fix the problem, and continue to work towards non-static builds. % root@qemux86-64:~# crictl --version crictl version 1.20.0-dirty Signed-off-by: Tim Orling <ticotimo@gmail.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/cri-tools')
-rw-r--r--recipes-containers/cri-tools/cri-tools/0001-build-allow-environmental-CGO-settings-and-pass-dont.patch52
-rw-r--r--recipes-containers/cri-tools/cri-tools_git.bb78
2 files changed, 130 insertions, 0 deletions
diff --git a/recipes-containers/cri-tools/cri-tools/0001-build-allow-environmental-CGO-settings-and-pass-dont.patch b/recipes-containers/cri-tools/cri-tools/0001-build-allow-environmental-CGO-settings-and-pass-dont.patch
new file mode 100644
index 00000000..5772c1ae
--- /dev/null
+++ b/recipes-containers/cri-tools/cri-tools/0001-build-allow-environmental-CGO-settings-and-pass-dont.patch
@@ -0,0 +1,52 @@
1From 28ee02687339b657a7aa93570015a6751c824e2d Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Wed, 10 Feb 2021 09:58:24 -0500
4Subject: [PATCH] build: allow environmental CGO settings and pass
5 dontusecurrentpkgs
6
7The build system already knows whether or not we want to use CGO,
8so we remove the hardcoded variant so our exported environment
9variable will control the enablement.
10
11Since our oe-core go infrastructure insists on both -pie and static
12builds (for the most part), and that is not recommended by many
13packages, we end up with errors like:
14
15 1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75/src/import/_output/crictl \
16 -ldflags '-X github.com/kubernetes-sigs/cri-tools/pkg/version.Version=1.20.0' \
17 -tags '' \
18 github.com/kubernetes-sigs/cri-tools/cmd/crictl
19 # github.com/kubernetes-sigs/cri-tools/cmd/crictl
20 cannot find package runtime/cgo (using -importcfg)
21 /work/cortexa72-poky-linux/cri-tools/1.20.0+gitec9e336fd8c21c4bab89a6aed2c4a138c8cfae75-r0/recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link:
22 cannot open file : open : no such file or directory
23
24In a similar manner to:
25
26https://www.yoctoproject.org/pipermail/meta-virtualization/2019-March/004084.html
27
28We introduce '-a -pkgdir dontusecurrentpkgs' to mask/fix the problem,
29and continue to work towards non-static builds.
30
31Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
32---
33 src/import/Makefile | 3 ++-
34 1 file changed, 2 insertions(+), 1 deletion(-)
35
36diff --git a/Makefile b/Makefile
37index acf0fc0..130988c 100644
38--- a/src/import/Makefile
39+++ b/src/import/Makefile
40@@ -63,7 +63,8 @@ critest:
41 $(PROJECT)/cmd/critest
42
43 crictl:
44- CGO_ENABLED=0 $(GO_BUILD) -o $(CURDIR)/_output/crictl$(BIN_EXT) \
45+ $(GO_BUILD) -o $(CURDIR)/_output/crictl$(BIN_EXT) \
46+ -a -pkgdir dontusecurrentpkgs \
47 -ldflags '$(GO_LDFLAGS)' \
48 -tags '$(BUILDTAGS)' \
49 $(PROJECT)/cmd/crictl
50--
512.19.1
52
diff --git a/recipes-containers/cri-tools/cri-tools_git.bb b/recipes-containers/cri-tools/cri-tools_git.bb
new file mode 100644
index 00000000..17ddbd02
--- /dev/null
+++ b/recipes-containers/cri-tools/cri-tools_git.bb
@@ -0,0 +1,78 @@
1HOMEPAGE = "https://github.com/kubernetes-sigs/cri-tools"
2SUMMARY = "CLI and validation tools for Kubelet Container Runtime Interface (CRI)"
3DESCRIPTION = "What is the scope of this project? \
4\
5cri-tools aims to provide a series of debugging and validation tools for \
6Kubelet CRI, which includes: \
7\
8 * crictl: CLI for kubelet CRI. \
9 * critest: validation test suites for kubelet CRI. \
10\
11What is not in scope for this project? \
12\
13 * Building a new kubelet container runtime based on CRI. \
14 * Managing pods/containers for CRI-compatible runtimes by end-users, e.g. \
15 pods created by crictl may be removed automatically by kubelet because of \
16 non-exist on the kube-apiserver. \
17 "
18
19SRCREV_cri-tools = "ec9e336fd8c21c4bab89a6aed2c4a138c8cfae75"
20SRC_URI = "\
21 git://github.com/kubernetes-sigs/cri-tools.git;branch=master;name=cri-tools \
22 file://0001-build-allow-environmental-CGO-settings-and-pass-dont.patch \
23 "
24
25LICENSE = "Apache-2.0"
26LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
27
28GO_IMPORT = "import"
29
30PV = "1.20.0+git${SRCREV_cri-tools}"
31
32RPROVIDES_${PN} += "crictl"
33PACKAGES =+ "${PN}-critest"
34
35inherit go
36inherit goarch
37inherit pkgconfig
38
39EXTRA_OEMAKE="BUILDTAGS=''"
40
41do_compile() {
42 # link fixups for compilation
43 rm -f ${S}/src/import/vendor/src
44 ln -sf ./ ${S}/src/import/vendor/src
45
46 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
47 cd ${S}/src/import
48
49 # Build the target binaries
50 export GOARCH="${TARGET_GOARCH}"
51 # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries
52 export CGO_ENABLED="1"
53 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
54 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
55 export CFLAGS=""
56 export LDFLAGS=""
57 export CC="${CC}"
58 export LD="${LD}"
59 export GOBIN=""
60
61 oe_runmake crictl
62}
63
64do_install() {
65 install -d ${D}${bindir}
66 install -m 755 -D ${S}/src/import/_output/* ${D}/${bindir}
67}
68
69FILES_${PN}-critest = "${bindir}/critest"
70
71# don't clobber hooks.d
72ALLOW_EMPTY_${PN} = "1"
73
74INSANE_SKIP_${PN} += "ldflags already-stripped textrel"
75
76deltask compile_ptest_base
77
78COMPATIBLE_HOST = "^(?!(qemu)?mips).*"