From 2543598628dcbf116ac5cd421158b39cc5f1116a Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Fri, 21 Feb 2020 16:17:11 +0800 Subject: [PATCH] Fix etcd issues on ARM - On unstable arch like ARM, etcd needs the "ETCD_UNSUPPORTED_ARCH" to be set `# etcd --version etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=arm64 set` - `tail -n +1 | head -n 1` is unnecessary, `head -n 1` is enough. --- hack/lib/etcd.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 05e5404171c..88f64fb0a09 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -45,13 +45,20 @@ kube::etcd::validate() { exit 1 fi + # need set the env of "ETCD_UNSUPPORTED_ARCH" on unstable arch. + arch=$(uname -m) + if [[ $arch =~ aarch* ]]; then + export ETCD_UNSUPPORTED_ARCH=arm64 + elif [[ $arch =~ arm* ]]; then + export ETCD_UNSUPPORTED_ARCH=arm + fi # validate installed version is at least equal to minimum - version=$(etcd --version | grep Version | tail -n +1 | head -n 1 | cut -d " " -f 3) + version=$(etcd --version | grep Version | head -n 1 | cut -d " " -f 3) if [[ $(kube::etcd::version "${ETCD_VERSION}") -gt $(kube::etcd::version "${version}") ]]; then export PATH=${KUBE_ROOT}/third_party/etcd:${PATH} hash etcd echo "${PATH}" - version=$(etcd --version | head -n 1 | cut -d " " -f 3) + version=$(etcd --version | grep Version | head -n 1 | cut -d " " -f 3) if [[ $(kube::etcd::version "${ETCD_VERSION}") -gt $(kube::etcd::version "${version}") ]]; then kube::log::usage "etcd version ${ETCD_VERSION} or greater required." kube::log::info "You can use 'hack/install-etcd.sh' to install a copy in third_party/."