Merge pull request #47776 from jianzhangbjz/build-hyperkube-ppc64le

Automatic merge from submit-queue

Parameterize the binary path and host arch for the hyperkube image

As the [cluster/images/hyperkube/README.md](https://github.com/kubernetes/kubernetes/tree/master/cluster/images/hyperkube) shows, I run the command: `make build VERSION=test ARCH=ppc64le`, but got the below errors, so this PR will fix it.
```
ARCH=ppc64le
cp -r ./* /tmp/hyperkubeTFbYrI
mkdir -p /tmp/hyperkubeTFbYrI/cni-bin
cp ../../../_output/dockerized/bin/linux/ppc64le/hyperkube /tmp/hyperkubeTFbYrI
cp: cannot stat '../../../_output/dockerized/bin/linux/ppc64le/hyperkube': No such file or directory
Makefile:62: recipe for target 'build' failed
make: *** [build] Error 1
```
This commit is contained in:
Kubernetes Submit Queue 2017-06-24 04:12:42 -07:00 committed by GitHub
commit d0ee6bb12a

View File

@ -23,6 +23,8 @@ TEMP_DIR:=$(shell mktemp -d -t hyperkubeXXXXXX)
CNI_RELEASE=0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff
CACHEBUST?=1
QEMUVERSION=v2.7.0
HYPERKUBE_BIN?=_output/dockerized/bin/linux/${ARCH}/hyperkube
HOSTARCH?=amd64
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Darwin)
@ -62,7 +64,8 @@ endif
cp -r ./* ${TEMP_DIR}
mkdir -p ${TEMP_DIR}/cni-bin
cp ../../../_output/dockerized/bin/linux/${ARCH}/hyperkube ${TEMP_DIR}
cp ../../../${HYPERKUBE_BIN} ${TEMP_DIR}
chmod a+rx ${TEMP_DIR}/hyperkube
cd ${TEMP_DIR} && sed -i.back "s|ARCH|${QEMUARCH}|g" Dockerfile
@ -71,8 +74,8 @@ ifeq ($(CACHEBUST),1)
cd ${TEMP_DIR} && sed -i.back "s|CACHEBUST|$(shell uuidgen)|g" Dockerfile
endif
ifeq ($(ARCH),amd64)
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
ifeq ($(ARCH),$(HOSTARCH))
# When building "normally", remove the whole line, it has no part in the image
cd ${TEMP_DIR} && ${SED_CMD} "/CROSS_BUILD_/d" Dockerfile
else
cd ${TEMP_DIR} && ${SED_CMD} "s/CROSS_BUILD_//g" Dockerfile