Bug fix: ./hack/install-etcd.sh is not work on Arm64 platform

Signed-off-by: Bin Lu <bin.lu@arm.com>
This commit is contained in:
Bin Lu 2019-01-10 17:29:49 +08:00
parent 7f0e04a089
commit 5cdb762fb9

View File

@ -105,11 +105,16 @@ kube::etcd::cleanup() {
kube::etcd::install() { kube::etcd::install() {
( (
local os local os
local arch
os=$(kube::util::host_os)
arch=$(kube::util::host_arch)
cd "${KUBE_ROOT}/third_party" cd "${KUBE_ROOT}/third_party"
os=$(uname | tr "[:upper:]" "[:lower:]")
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
return # already installed return # already installed
fi fi
if [[ ${os} == "darwin" ]]; then if [[ ${os} == "darwin" ]]; then
download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip" download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}" url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
@ -118,11 +123,11 @@ kube::etcd::install() {
ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd
rm "${download_file}" rm "${download_file}"
else else
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz" url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-${arch}.tar.gz"
download_file="etcd-v${ETCD_VERSION}-linux-amd64.tar.gz" download_file="etcd-v${ETCD_VERSION}-linux-${arch}.tar.gz"
kube::util::download_file "${url}" "${download_file}" kube::util::download_file "${url}" "${download_file}"
tar xzf "${download_file}" tar xzf "${download_file}"
ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd ln -fns "etcd-v${ETCD_VERSION}-linux-${arch}" etcd
rm "${download_file}" rm "${download_file}"
fi fi
kube::log::info "etcd v${ETCD_VERSION} installed. To use:" kube::log::info "etcd v${ETCD_VERSION} installed. To use:"