mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #79692 from chendave/issue_79689
Address couple of issue on image build for ARM arch
This commit is contained in:
commit
3c09a870a4
@ -53,7 +53,7 @@ MANIFEST_IMAGE := $(PUSH_REGISTRY)/etcd
|
|||||||
export DOCKER_CLI_EXPERIMENTAL := enabled
|
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 should match the golang version from https://github.com/coreos/etcd/releases for the current ETCD_VERSION.
|
||||||
GOLANG_VERSION?=1.10.4
|
GOLANG_VERSION?=1.10.4
|
||||||
GOARM=7
|
GOARM?=7
|
||||||
TEMP_DIR:=$(shell mktemp -d)
|
TEMP_DIR:=$(shell mktemp -d)
|
||||||
|
|
||||||
ifeq ($(ARCH),amd64)
|
ifeq ($(ARCH),amd64)
|
||||||
@ -97,13 +97,18 @@ else
|
|||||||
|
|
||||||
# Download etcd in a golang container and cross-compile it statically
|
# 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.
|
# 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 \
|
for version in $(BUNDLED_ETCD_VERSIONS); do \
|
||||||
etcd_release_tmp_dir=$(shell mktemp -d); \
|
etcd_release_tmp_dir=$(shell mktemp -d); \
|
||||||
docker run --interactive -v $${etcd_release_tmp_dir}:/etcdbin golang:$(GOLANG_VERSION) /bin/bash -c \
|
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 \
|
"git clone https://github.com/coreos/etcd /go/src/github.com/coreos/etcd \
|
||||||
&& cd /go/src/github.com/coreos/etcd \
|
&& cd /go/src/github.com/coreos/etcd \
|
||||||
&& git checkout v$${version} \
|
&& 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 -f bin/$(ARCH)/etcd* bin/etcd* /etcdbin; echo 'done'"; \
|
||||||
cp $$etcd_release_tmp_dir/etcd $$etcd_release_tmp_dir/etcdctl $(TEMP_DIR)/; \
|
cp $$etcd_release_tmp_dir/etcd $$etcd_release_tmp_dir/etcdctl $(TEMP_DIR)/; \
|
||||||
cp $(TEMP_DIR)/etcd $(TEMP_DIR)/etcd-$$version; \
|
cp $(TEMP_DIR)/etcd $(TEMP_DIR)/etcd-$$version; \
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
include ../../hack/make-rules/Makefile.manifest
|
include ../../hack/make-rules/Makefile.manifest
|
||||||
|
|
||||||
REGISTRY ?= gcr.io/kubernetes-e2e-test-images
|
REGISTRY ?= gcr.io/kubernetes-e2e-test-images
|
||||||
GOARM=7
|
GOARM ?= 7
|
||||||
QEMUVERSION=v2.9.1
|
QEMUVERSION=v2.9.1
|
||||||
GOLANG_VERSION=1.12.6
|
GOLANG_VERSION=1.12.6
|
||||||
export
|
export
|
||||||
|
@ -88,7 +88,7 @@ build() {
|
|||||||
if [[ $(id -u) != 0 ]]; then
|
if [[ $(id -u) != 0 ]]; then
|
||||||
sudo=sudo
|
sudo=sudo
|
||||||
fi
|
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}"
|
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
|
# Ensure we don't get surprised by umask settings
|
||||||
chmod 0755 "${temp_dir}/qemu-${QEMUARCHS[$arch]}-static"
|
chmod 0755 "${temp_dir}/qemu-${QEMUARCHS[$arch]}-static"
|
||||||
@ -140,13 +140,17 @@ push() {
|
|||||||
|
|
||||||
# This function is for building the go code
|
# This function is for building the go code
|
||||||
bin() {
|
bin() {
|
||||||
|
local arch_prefix=""
|
||||||
|
if [[ "${ARCH}" == "arm" ]]; then
|
||||||
|
arch_prefix="GOARM=${GOARM:-7}"
|
||||||
|
fi
|
||||||
for SRC in $@;
|
for SRC in $@;
|
||||||
do
|
do
|
||||||
docker run --rm -it -v "${TARGET}:${TARGET}:Z" -v "${KUBE_ROOT}":/go/src/k8s.io/kubernetes:Z \
|
docker run --rm -it -v "${TARGET}:${TARGET}:Z" -v "${KUBE_ROOT}":/go/src/k8s.io/kubernetes:Z \
|
||||||
golang:"${GOLANG_VERSION}" \
|
golang:"${GOLANG_VERSION}" \
|
||||||
/bin/bash -c "\
|
/bin/bash -c "\
|
||||||
cd /go/src/k8s.io/kubernetes/test/images/${SRC_DIR} && \
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
SRCS=regression-issue-74839
|
SRCS=regression-issue-74839
|
||||||
ARCH ?= amd64
|
ARCH ?= amd64
|
||||||
TARGET ?= $(CURDIR)
|
TARGET ?= $(CURDIR)
|
||||||
GOARM = 7
|
GOARM ?= 7
|
||||||
GOLANG_VERSION ?= latest
|
GOLANG_VERSION ?= latest
|
||||||
SRC_DIR = $(notdir $(shell pwd))
|
SRC_DIR = $(notdir $(shell pwd))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user