Skip to content

Commit

Permalink
Merge pull request kubernetes#111613 from dims/avoid-hardcoding-os-an…
Browse files Browse the repository at this point in the history
…d-arch-installing-etcd

Avoid hard coding Operating System and Architecture in hack/lib/etcd.sh
  • Loading branch information
k8s-ci-robot committed Aug 3, 2022
2 parents cf777ab + 1380fc5 commit 49bcbe6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions hack/lib/etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,21 @@ kube::etcd::install() {
fi

if [[ ${os} == "darwin" ]]; then
download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.zip"
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
kube::util::download_file "${url}" "${download_file}"
unzip -o "${download_file}"
ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd
ln -fns "etcd-v${ETCD_VERSION}-${os}-${arch}" etcd
rm "${download_file}"
else
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-${arch}.tar.gz"
elif [[ ${os} == "linux" ]]; then
url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.tar.gz"
kube::util::download_file "${url}" "${download_file}"
tar xzf "${download_file}"
ln -fns "etcd-v${ETCD_VERSION}-linux-${arch}" etcd
ln -fns "etcd-v${ETCD_VERSION}-${os}-${arch}" etcd
rm "${download_file}"
else
kube::log::info "${os} is NOT supported."
fi
kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""
Expand Down

0 comments on commit 49bcbe6

Please sign in to comment.