From 94a00872df795f4b31ae98aa6ca724e7921eaab0 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Mon, 1 Feb 2021 17:02:05 +0100 Subject: [PATCH 1/3] app-emulation/cri-tools: sync with Gentoo To add a new ebuild `app-emulation-cri-tools`, sync with Gentoo. --- .../app-emulation/cri-tools/Manifest | 1 + .../cri-tools/cri-tools-1.18.0.ebuild | 32 +++++++++++++++++++ .../app-emulation/cri-tools/metadata.xml | 8 +++++ 3 files changed, 41 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/metadata.xml diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest new file mode 100644 index 0000000000..7e57aa95da --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest @@ -0,0 +1 @@ +DIST cri-tools-1.18.0.tar.gz 5295512 BLAKE2B 9dda4a401b858e98aa60521d3268d8f6ff6a2c1bd2c219a0e5e9e5360fba58d41e97258c636da26ee57bbfc3286798c74107c7de92d3e3398bdf53b7d9078e94 SHA512 849b496e6d19eec29e0e56f0b37c094649311b80514f319b0c68c6519e3ddd48e1973c3d288144db998826676416644ec705b7ea0916c21898b40928ea800af1 diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild new file mode 100644 index 0000000000..32412429f5 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild @@ -0,0 +1,32 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit bash-completion-r1 go-module +MY_PV="v${PV/_beta/-beta.}" + +DESCRIPTION="CLI and validation tools for Kubelet Container Runtime (CRI)" +HOMEPAGE="https://github.com/kubernetes-sigs/cri-tools" +SRC_URI="https://github.com/kubernetes-sigs/cri-tools/archive/${MY_PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0" +SLOT="0" +KEYWORDS="amd64" + +RESTRICT+=" test" + +src_compile() { + emake VERSION="${MY_PV}" + _output/crictl completion bash > ${PN}.bash || die + _output/crictl completion zsh > ${PN}.zsh || die +} + +src_install() { + dobin _output/crictl + + newbashcomp ${PN}.bash ${PN} + insinto /usr/share/zsh/site-functions + newins ${PN}.zsh _${PN} + + dodoc -r docs {README,RELEASE,CHANGELOG,CONTRIBUTING}.md +} diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/metadata.xml b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/metadata.xml new file mode 100644 index 0000000000..ded6fbaced --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/metadata.xml @@ -0,0 +1,8 @@ + + + + + + kubernetes-sigs/cri-tools + + From 13946b551d4869418f3bea5b397dbdb4fb672a7b Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Tue, 2 Feb 2021 14:12:14 +0100 Subject: [PATCH 2/3] app-emulation/cri-tools: apply Flatcar patches Update to 1.19.0, to keep up with recent releases of cri-tools. Note that we should not simply update to 1.20.0, because its crictl binary file is 30M, so bigger than the usual size. On the other hand, crictl 1.19.0 is only 21M. To optimize the binary size of crictl, make use of the existing helpers provided by `coreos-go.eclass`. Add "-X $(PROJECT)/pkg/version.Version=$(VERSION)" to GO_LDFLAGS, as the original cri-tools Makefile does. Note, we cannot run the native command like `emake crictl`, because the cri-tools Makefile does not allow custom env variables like BUILDTAGS or GO_LDFLAGS to be configured. Add `arm64` to ACCEPTED_KEYWORDS. Remove unnecessary files from installation, as well as the bash completion eclass. --- .../app-emulation/cri-tools/Manifest | 2 +- .../cri-tools/cri-tools-1.18.0.ebuild | 32 -------------- .../cri-tools/cri-tools-1.19.0.ebuild | 44 +++++++++++++++++++ 3 files changed, 45 insertions(+), 33 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.19.0.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest index 7e57aa95da..4616878b78 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/Manifest @@ -1 +1 @@ -DIST cri-tools-1.18.0.tar.gz 5295512 BLAKE2B 9dda4a401b858e98aa60521d3268d8f6ff6a2c1bd2c219a0e5e9e5360fba58d41e97258c636da26ee57bbfc3286798c74107c7de92d3e3398bdf53b7d9078e94 SHA512 849b496e6d19eec29e0e56f0b37c094649311b80514f319b0c68c6519e3ddd48e1973c3d288144db998826676416644ec705b7ea0916c21898b40928ea800af1 +DIST cri-tools-1.19.0.tar.gz 5199406 BLAKE2B 59102098a29b2454ab21e5fae0440f1ed7a550f48890806b2663c97de936e9a88c44c9c1dee1b65e94e3495d823c03dbaa9fc28319e4eb5cae736559e1692c55 SHA512 40c9df3623258a0b787a903113d522f93cb084f8c5840cebdfdf36ba57b6ae3ac0ee11fda1414f4ed4c977f8bc2d255dee7f1b07832fa82ab65010717952fb64 diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild deleted file mode 100644 index 32412429f5..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.18.0.ebuild +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 -inherit bash-completion-r1 go-module -MY_PV="v${PV/_beta/-beta.}" - -DESCRIPTION="CLI and validation tools for Kubelet Container Runtime (CRI)" -HOMEPAGE="https://github.com/kubernetes-sigs/cri-tools" -SRC_URI="https://github.com/kubernetes-sigs/cri-tools/archive/${MY_PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0" -SLOT="0" -KEYWORDS="amd64" - -RESTRICT+=" test" - -src_compile() { - emake VERSION="${MY_PV}" - _output/crictl completion bash > ${PN}.bash || die - _output/crictl completion zsh > ${PN}.zsh || die -} - -src_install() { - dobin _output/crictl - - newbashcomp ${PN}.bash ${PN} - insinto /usr/share/zsh/site-functions - newins ${PN}.zsh _${PN} - - dodoc -r docs {README,RELEASE,CHANGELOG,CONTRIBUTING}.md -} diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.19.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.19.0.ebuild new file mode 100644 index 0000000000..fd52edd1cb --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/cri-tools/cri-tools-1.19.0.ebuild @@ -0,0 +1,44 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit coreos-go + +COREOS_GO_VERSION="go1.15" +COREOS_GO_PACKAGE="github.com/kubernetes-sigs/cri-tools" +COREOS_GO_MOD="vendor" + +MY_PV="v${PV/_beta/-beta.}" + +EGO_PN="${COREOS_GO_PACKAGE}" +DESCRIPTION="CLI and validation tools for Kubelet Container Runtime (CRI)" +HOMEPAGE="https://github.com/kubernetes-sigs/cri-tools" +SRC_URI="https://github.com/kubernetes-sigs/cri-tools/archive/${MY_PV}.tar.gz -> ${P}.tar.gz" +LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0" +SLOT="0" +# Flatcar: keyword arm64 +KEYWORDS="amd64 arm64" + +S=${WORKDIR}/cri-tools-${PV} + +DEPEND="" +RDEPEND="${DEPEND}" + +src_compile() { + # Flatcar: to optimize the binary size of crictl, make use of the existing + # helpers provided by `coreos-go.eclass`. + # Add "-X $(PROJECT)/pkg/version.Version=$(VERSION)" to GO_LDFLAGS, + # as the original cri-tools Makefile does. + # Note, we cannot run the native command like `emake crictl`, because + # the cri-tools Makefile does not allow custom env variables like BUILDTAGS + # or GO_LDFLAGS to be configured. + GO_LDFLAGS="-s -w -extldflags=-Wl,-z,now,-z,relro,-z,defs " + GO_LDFLAGS+="-X ${COREOS_GO_PACKAGE}/pkg/version.Version=${PV} " + go_build "${COREOS_GO_PACKAGE}/cmd/crictl" +} + +src_install() { + # Flatcar: install only crictl binary + dobin "${GOBIN}/crictl" +} From dacbfd77210aebd8c80be53dd02fdd7ae4c5a82b Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Tue, 2 Feb 2021 14:12:16 +0100 Subject: [PATCH 3/3] coreos-base/coreos: add cri-tools to base packages Add a new ebuild `app-emulation/cri-tools` to the dependencies list of `coreos-base/coreos`, to get included in the production image. --- .../{coreos-0.0.1-r297.ebuild => coreos-0.0.1-r298.ebuild} | 0 .../coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild | 1 + 2 files changed, 1 insertion(+) rename sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/{coreos-0.0.1-r297.ebuild => coreos-0.0.1-r298.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r297.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r298.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r297.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1-r298.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild index a104c375c9..903d86593d 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos/coreos-0.0.1.ebuild @@ -104,6 +104,7 @@ RDEPEND="${RDEPEND} app-editors/vim app-emulation/rkt app-emulation/actool + app-emulation/cri-tools app-misc/ca-certificates app-misc/jq app-shells/bash