From dec4d1ea3326ce67a5adf27426d5a5fc9841a7d8 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Mon, 15 Aug 2016 16:20:15 -0700 Subject: [PATCH] Disable linux/ppc64le compilation by default. It can be reenabled with KUBE_BUILD_PPC64LE=y. --- build/common.sh | 18 ++++++++++++------ hack/lib/golang.sh | 26 ++++++++++++-------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build/common.sh b/build/common.sh index feaba83ed9b..38d7e486d98 100755 --- a/build/common.sh +++ b/build/common.sh @@ -43,6 +43,15 @@ readonly KUBE_GCS_DOCKER_REG_PREFIX=${KUBE_GCS_DOCKER_REG_PREFIX-docker-reg}/ readonly KUBE_GCS_PUBLISH_VERSION=${KUBE_GCS_PUBLISH_VERSION:-} readonly KUBE_GCS_DELETE_EXISTING="${KUBE_GCS_DELETE_EXISTING:-n}" +# Set KUBE_BUILD_PPC64LE to y to build for ppc64le in addition to other +# platforms. +# TODO(IBM): remove KUBE_BUILD_PPC64LE and reenable ppc64le compilation by +# default when +# https://github.com/kubernetes/kubernetes/issues/30384 and +# https://github.com/kubernetes/kubernetes/issues/25886 are fixed. +# The majority of the logic is in hack/lib/golang.sh. +readonly KUBE_BUILD_PPC64LE="${KUBE_BUILD_PPC64LE:-n}" + # Constants readonly KUBE_BUILD_IMAGE_REPO=kube-build readonly KUBE_BUILD_IMAGE_CROSS_TAG="$(cat build/build-image/cross/VERSION)" @@ -602,6 +611,7 @@ function kube::build::run_build_command() { docker_run_opts+=( --env "KUBE_FASTBUILD=${KUBE_FASTBUILD:-false}" --env "KUBE_BUILDER_OS=${OSTYPE:-notdetected}" + --env "KUBE_BUILD_PPC64LE=${KUBE_BUILD_PPC64LE}" # TODO(IBM): remove ) # If we have stdin we can run interactive. This allows things like 'shell.sh' @@ -698,12 +708,8 @@ function kube::release::package_hyperkube() { # If we have these variables set then we want to build all docker images. if [[ -n "${KUBE_DOCKER_IMAGE_TAG-}" && -n "${KUBE_DOCKER_REGISTRY-}" ]]; then for arch in "${KUBE_SERVER_PLATFORMS[@]##*/}"; do - - # TODO(IBM): Enable hyperkube builds for ppc64le again - if [[ ${arch} != "ppc64le" ]]; then - kube::log::status "Building hyperkube image for arch: ${arch}" - REGISTRY="${KUBE_DOCKER_REGISTRY}" VERSION="${KUBE_DOCKER_IMAGE_TAG}" ARCH="${arch}" make -C cluster/images/hyperkube/ build - fi + kube::log::status "Building hyperkube image for arch: ${arch}" + REGISTRY="${KUBE_DOCKER_REGISTRY}" VERSION="${KUBE_DOCKER_IMAGE_TAG}" ARCH="${arch}" make -C cluster/images/hyperkube/ build done fi } diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 15e7ccb0daf..59ec4f85cb3 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -70,26 +70,32 @@ if [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then else # The server platform we are building on. - readonly KUBE_SERVER_PLATFORMS=( + KUBE_SERVER_PLATFORMS=( linux/amd64 linux/arm linux/arm64 - linux/ppc64le # note: hyperkube is temporarily disabled due to a linking error ) + if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then + KUBE_SERVER_PLATFORMS+=(linux/ppc64le) + fi + readonly KUBE_SERVER_PLATFORMS # If we update this we should also update the set of golang compilers we build # in 'build/build-image/cross/Dockerfile'. However, it's only a bit faster since go 1.5, not mandatory - readonly KUBE_CLIENT_PLATFORMS=( + KUBE_CLIENT_PLATFORMS=( linux/amd64 linux/386 linux/arm linux/arm64 - linux/ppc64le darwin/amd64 darwin/386 windows/amd64 windows/386 ) + if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then + KUBE_CLIENT_PLATFORMS+=(linux/ppc64le) + fi + readonly KUBE_CLIENT_PLATFORMS # Which platforms we should compile test targets for. Not all client platforms need these tests readonly KUBE_TEST_PLATFORMS=( @@ -461,15 +467,7 @@ kube::golang::build_binaries_for_platform() { for binary in "${binaries[@]}"; do - # TODO(IBM): Enable hyperkube builds for ppc64le again - # The current workaround creates a text file with help text instead of a binary - # We're doing it this way so the build system isn't affected so much - if [[ "${binary}" == *"hyperkube" && "${platform}" == "linux/ppc64le" ]]; then - echo "hyperkube build for ppc64le is disabled. Creating dummy text file instead." - local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}") - mkdir -p $(dirname ${outfile}) - echo "Not available at the moment. Please see: https://github.com/kubernetes/kubernetes/issues/25886 for more information." > ${outfile} - elif [[ "${binary}" =~ ".test"$ ]]; then + if [[ "${binary}" =~ ".test"$ ]]; then tests+=($binary) elif kube::golang::is_statically_linked_library "${binary}"; then statics+=($binary) @@ -668,7 +666,7 @@ kube::golang::build_binaries() { kube::golang::build_kube_toolchain if [[ "${parallel}" == "true" ]]; then - kube::log::status "Building go targets for ${platforms[@]} in parallel (output will appear in a burst when complete):" "${targets[@]}" + kube::log::status "Building go targets for {${platforms[*]}} in parallel (output will appear in a burst when complete):" "${targets[@]}" local platform for platform in "${platforms[@]}"; do ( kube::golang::set_platform_envs "${platform}"