diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile index 874f3a86bd1..5bb50126187 100644 --- a/cluster/images/etcd/Makefile +++ b/cluster/images/etcd/Makefile @@ -53,7 +53,7 @@ MANIFEST_IMAGE := $(PUSH_REGISTRY)/etcd export DOCKER_CLI_EXPERIMENTAL := enabled # golang version should match the golang version from https://github.com/coreos/etcd/releases for the current ETCD_VERSION. GOLANG_VERSION?=1.10.4 -GOARM=7 +GOARM?=7 TEMP_DIR:=$(shell mktemp -d) ifeq ($(ARCH),amd64) @@ -97,13 +97,18 @@ else # Download etcd in a golang container and cross-compile it statically # For each release create a tmp dir 'etcd_release_tmp_dir' and unpack the release tar there. + arch_prefix="" + ifeq ($(ARCH),arm) + arch_prefix="GOARM=$(GOARM)" + endif + for version in $(BUNDLED_ETCD_VERSIONS); do \ etcd_release_tmp_dir=$(shell mktemp -d); \ docker run --interactive -v $${etcd_release_tmp_dir}:/etcdbin golang:$(GOLANG_VERSION) /bin/bash -c \ "git clone https://github.com/coreos/etcd /go/src/github.com/coreos/etcd \ && cd /go/src/github.com/coreos/etcd \ && git checkout v$${version} \ - && GOARM=$(GOARM) GOARCH=$(ARCH) ./build \ + && $(arch_prefix) GOARCH=$(ARCH) ./build \ && cp -f bin/$(ARCH)/etcd* bin/etcd* /etcdbin; echo 'done'"; \ cp $$etcd_release_tmp_dir/etcd $$etcd_release_tmp_dir/etcdctl $(TEMP_DIR)/; \ cp $(TEMP_DIR)/etcd $(TEMP_DIR)/etcd-$$version; \ diff --git a/test/images/Makefile b/test/images/Makefile index d0d807f2f27..bffba54718f 100644 --- a/test/images/Makefile +++ b/test/images/Makefile @@ -15,7 +15,7 @@ include ../../hack/make-rules/Makefile.manifest REGISTRY ?= gcr.io/kubernetes-e2e-test-images -GOARM=7 +GOARM ?= 7 QEMUVERSION=v2.9.1 GOLANG_VERSION=1.12.6 export diff --git a/test/images/image-util.sh b/test/images/image-util.sh index 974c45121f4..84a21ddba89 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -88,7 +88,7 @@ build() { if [[ $(id -u) != 0 ]]; then sudo=sudo fi - "${sudo}" "${KUBE_ROOT}/third_party/multiarch/qemu-user-static/register/register.sh" --reset + ${sudo} "${KUBE_ROOT}/third_party/multiarch/qemu-user-static/register/register.sh" --reset curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/"${QEMUVERSION}"/x86_64_qemu-"${QEMUARCHS[$arch]}"-static.tar.gz | tar -xz -C "${temp_dir}" # Ensure we don't get surprised by umask settings chmod 0755 "${temp_dir}/qemu-${QEMUARCHS[$arch]}-static" @@ -140,13 +140,17 @@ push() { # This function is for building the go code bin() { + local arch_prefix="" + if [[ "${ARCH}" == "arm" ]]; then + arch_prefix="GOARM=${GOARM:-7}" + fi for SRC in $@; do docker run --rm -it -v "${TARGET}:${TARGET}:Z" -v "${KUBE_ROOT}":/go/src/k8s.io/kubernetes:Z \ golang:"${GOLANG_VERSION}" \ /bin/bash -c "\ cd /go/src/k8s.io/kubernetes/test/images/${SRC_DIR} && \ - CGO_ENABLED=0 GOARM=${GOARM} GOARCH=${ARCH} go build -a -installsuffix cgo --ldflags '-w' -o ${TARGET}/${SRC} ./$(dirname "${SRC}")" + CGO_ENABLED=0 ${arch_prefix} GOARCH=${ARCH} go build -a -installsuffix cgo --ldflags '-w' -o ${TARGET}/${SRC} ./$(dirname "${SRC}")" done } diff --git a/test/images/regression-issue-74839/Makefile b/test/images/regression-issue-74839/Makefile index 930b25f1abe..bace6da6235 100644 --- a/test/images/regression-issue-74839/Makefile +++ b/test/images/regression-issue-74839/Makefile @@ -15,7 +15,7 @@ SRCS=regression-issue-74839 ARCH ?= amd64 TARGET ?= $(CURDIR) -GOARM = 7 +GOARM ?= 7 GOLANG_VERSION ?= latest SRC_DIR = $(notdir $(shell pwd))