Commit 9bc7e36f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #32517 from luxas/fix_arm_ppc64le

Automatic merge from submit-queue Use a patched golang version for building linux/arm Fixes: #29904 Right now, linux/arm is broken because of an internal limitation in Go. I've filed an issue for it here: https://github.com/golang/go/issues/17028 The affected binaries of this limitation are hyperkube and kube-apiserver, which are the largest binaries. And when we now have a patched go 1.7.1 version for building "unsupported" but important architectures (ref: https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/multi-platform.md), we should also include the patch for ppc64le and start building ppc64le again. As soon as @laboger has the patch I need up on Github, I'll include ppc64le to this PR and we'll merge it TODO: - [ ] ~~Update the PR with patches for ppc64le at the same time @luxas~~ - [x] Push the new kube-cross image @ixdy - [x] Run a full `make release` before to verify nothing breaks @luxas + @ixdy - [ ] Cherrypick into the 1.4 branch @luxas + (who?) @lavalamp @smarterclayton @ixdy @rsc @davecheney @wojtek-t @jfrazelle @bradfitz @david-mcmahon @pwittrock
parents 32ba5815 aa045f78
......@@ -18,8 +18,8 @@ FROM gcr.io/google_containers/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
# Mark this as a kube-build container
RUN touch /kube-build-image
# TO run as non-root we sometimes need to rebuild go stdlib packages.
RUN chmod -R a+rwx /usr/local/go/pkg
# To run as non-root we sometimes need to rebuild go stdlib packages.
RUN chmod -R a+rwx /usr/local/go/pkg ${K8S_PATCHED_GOROOT}/pkg
# The kubernetes source is expected to be mounted here. This will be the base
# of operations.
......
......@@ -35,7 +35,7 @@ RUN for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${plat
# Install g++, then download and install protoc for generating protobuf output
RUN apt-get update \
&& apt-get install -y g++ rsync apt-utils file \
&& apt-get install -y g++ rsync apt-utils file patch \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/src/protobuf \
......@@ -77,3 +77,16 @@ RUN export ETCD_VERSION=v2.2.1; \
&& cd /usr/local/src/etcd \
&& curl -fsSL https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz | tar -xz \
&& ln -s ../src/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd /usr/local/bin/
# TODO: Remove the patched GOROOT when we have an official golang that has a working arm and ppc64le linker
ENV K8S_PATCHED_GOLANG_VERSION=1.7.1 \
K8S_PATCHED_GOROOT=/usr/local/go_k8s_patched
RUN mkdir -p ${K8S_PATCHED_GOROOT} \
&& curl -sSL https://github.com/golang/go/archive/go${K8S_PATCHED_GOLANG_VERSION}.tar.gz | tar -xz -C ${K8S_PATCHED_GOROOT} --strip-components=1
COPY golang-patches/CL28857-go1.7.1-luxas.patch ${K8S_PATCHED_GOROOT}/
RUN cd ${K8S_PATCHED_GOROOT} \
&& patch -p1 < CL28857-go1.7.1-luxas.patch \
&& cd src \
&& GOROOT_FINAL=${K8S_PATCHED_GOROOT} GOROOT_BOOTSTRAP=/usr/local/go ./make.bash \
&& for platform in linux/arm; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_PATCHED_GOROOT} go install std; done
......@@ -10,7 +10,7 @@
"containers": [
{
"name": "etcd",
"image": "gcr.io/google_containers/etcd-ARCH:2.2.1",
"image": "gcr.io/google_containers/etcd-ARCH:2.2.5",
"command": [
"/usr/local/bin/etcd",
"--listen-client-urls=http://127.0.0.1:2379,http://127.0.0.1:4001",
......
......@@ -100,7 +100,6 @@ else
linux/amd64
darwin/amd64
windows/amd64
linux/arm
)
fi
......@@ -226,7 +225,7 @@ kube::golang::current_platform() {
# for that platform.
kube::golang::set_platform_envs() {
[[ -n ${1-} ]] || {
kube::log::error_exit "!!! Internal error. No platform set in kube::golang::set_platform_envs"
kube::log::error_exit "!!! Internal error. No platform set in kube::golang::set_platform_envs"
}
export GOOS=${platform%/*}
......@@ -240,6 +239,7 @@ kube::golang::set_platform_envs() {
if [[ ${platform} == "linux/arm" ]]; then
export CGO_ENABLED=1
export CC=arm-linux-gnueabi-gcc
export GOROOT=${K8S_PATCHED_GOROOT}
elif [[ ${platform} == "linux/arm64" ]]; then
export CGO_ENABLED=1
export CC=aarch64-linux-gnu-gcc
......@@ -253,6 +253,7 @@ kube::golang::set_platform_envs() {
kube::golang::unset_platform_envs() {
unset GOOS
unset GOARCH
unset GOROOT
unset CGO_ENABLED
unset CC
}
......@@ -477,6 +478,11 @@ kube::golang::build_binaries_for_platform() {
kube::golang::fallback_if_stdlib_not_installable;
fi
# TODO: Remove this temporary workaround when we have the official golang linker working
if [[ ${platform} == "linux/arm" ]]; then
gogcflags="${gogcflags} -largemodel"
fi
if [[ -n ${use_go_build:-} ]]; then
kube::log::progress " "
for binary in "${statics[@]:+${statics[@]}}"; do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment