summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2023-08-23 10:02:08 -0500
committerWilliam Hubbs <williamh@gentoo.org>2023-08-23 10:02:08 -0500
commite2abc4afe1a0b0132609ebf115abababb9d77d6b (patch)
tree13946c5d79ab7a7d2adce38f9c6ec64724e55c39 /sys-cluster
parentsys-cluster/kube-proxy: make gomaxprocs install optional (diff)
downloadgentoo-e2abc4afe1a0b0132609ebf115abababb9d77d6b.tar.gz
gentoo-e2abc4afe1a0b0132609ebf115abababb9d77d6b.tar.bz2
gentoo-e2abc4afe1a0b0132609ebf115abababb9d77d6b.zip
sys-cluster/kube-scheduler: make gomaxprocs install optional
Bug: https://bugs.gentoo.org/912781 Signed-off-by: William Hubbs <williamh@gentoo.org>
Diffstat (limited to 'sys-cluster')
-rw-r--r--sys-cluster/kube-scheduler/files/kube-scheduler-1.28.0-make-gomaxprocs-install-optional.patch78
-rw-r--r--sys-cluster/kube-scheduler/kube-scheduler-1.28.0.ebuild4
2 files changed, 82 insertions, 0 deletions
diff --git a/sys-cluster/kube-scheduler/files/kube-scheduler-1.28.0-make-gomaxprocs-install-optional.patch b/sys-cluster/kube-scheduler/files/kube-scheduler-1.28.0-make-gomaxprocs-install-optional.patch
new file mode 100644
index 000000000000..1a8935b31c9c
--- /dev/null
+++ b/sys-cluster/kube-scheduler/files/kube-scheduler-1.28.0-make-gomaxprocs-install-optional.patch
@@ -0,0 +1,78 @@
+From cce3f6ffa796ea416021b0d62567a3f52b979567 Mon Sep 17 00:00:00 2001
+From: Jordan Liggitt <liggitt@google.com>
+Date: Wed, 16 Aug 2023 09:33:02 -0400
+Subject: [PATCH 2/2] Make gomaxprocs install optional, limit to tests
+
+---
+ hack/lib/golang.sh | 25 +++++++++++++++----------
+ hack/make-rules/test-e2e-node.sh | 1 +
+ hack/make-rules/test.sh | 1 +
+ 3 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
+index 66772f08a81..983ff368e25 100755
+--- a/hack/lib/golang.sh
++++ b/hack/lib/golang.sh
+@@ -556,20 +556,25 @@ kube::golang::setup_env() {
+
+ # This seems to matter to some tools
+ export GO15VENDOREXPERIMENT=1
++}
+
++kube::golang::setup_gomaxprocs() {
+ # GOMAXPROCS by default does not reflect the number of cpu(s) available
+ # when running in a container, please see https://github.com/golang/go/issues/33803
+- if ! command -v ncpu >/dev/null 2>&1; then
+- # shellcheck disable=SC2164
+- pushd "${KUBE_ROOT}/hack/tools" >/dev/null
+- GO111MODULE=on go install ./ncpu
+- # shellcheck disable=SC2164
+- popd >/dev/null
++ if [[ -z "${GOMAXPROCS:-}" ]]; then
++ if ! command -v ncpu >/dev/null 2>&1; then
++ # shellcheck disable=SC2164
++ pushd "${KUBE_ROOT}/hack/tools" >/dev/null
++ GO111MODULE=on go install ./ncpu || echo "Will not automatically set GOMAXPROCS"
++ # shellcheck disable=SC2164
++ popd >/dev/null
++ fi
++ if command -v ncpu >/dev/null 2>&1; then
++ GOMAXPROCS=$(ncpu)
++ export GOMAXPROCS
++ kube::log::status "Set GOMAXPROCS automatically to ${GOMAXPROCS}"
++ fi
+ fi
+-
+- GOMAXPROCS=${GOMAXPROCS:-$(ncpu)}
+- export GOMAXPROCS
+- kube::log::status "Setting GOMAXPROCS: ${GOMAXPROCS}"
+ }
+
+ # This will take binaries from $GOPATH/bin and copy them to the appropriate
+diff --git a/hack/make-rules/test-e2e-node.sh b/hack/make-rules/test-e2e-node.sh
+index 43dde0c740f..49e3e04ac71 100755
+--- a/hack/make-rules/test-e2e-node.sh
++++ b/hack/make-rules/test-e2e-node.sh
+@@ -18,6 +18,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
+ source "${KUBE_ROOT}/hack/lib/init.sh"
+
+ kube::golang::setup_env
++kube::golang::setup_gomaxprocs
+
+ # start the cache mutation detector by default so that cache mutators will be found
+ KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"
+diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh
+index e9074678a8f..4aa72730d83 100755
+--- a/hack/make-rules/test.sh
++++ b/hack/make-rules/test.sh
+@@ -22,6 +22,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
+ source "${KUBE_ROOT}/hack/lib/init.sh"
+
+ kube::golang::setup_env
++kube::golang::setup_gomaxprocs
+
+ # start the cache mutation detector by default so that cache mutators will be found
+ KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"
+--
+2.41.0
+
diff --git a/sys-cluster/kube-scheduler/kube-scheduler-1.28.0.ebuild b/sys-cluster/kube-scheduler/kube-scheduler-1.28.0.ebuild
index 038445235f63..d2d2dc5e3ba5 100644
--- a/sys-cluster/kube-scheduler/kube-scheduler-1.28.0.ebuild
+++ b/sys-cluster/kube-scheduler/kube-scheduler-1.28.0.ebuild
@@ -22,6 +22,10 @@ BDEPEND=">=dev-lang/go-1.20"
RESTRICT+=" test"
S="${WORKDIR}/kubernetes-${PV}"
+PATCHES=(
+ "${FILESDIR}"/${P}-make-gomaxprocs-install-optional.patch
+)
+
src_compile() {
CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')" \
emake -j1 GOFLAGS="" GOLDFLAGS="" LDFLAGS="" WHAT=cmd/${PN}