Merge pull request #121493 from BenTheElder/etcd-current
automatically setup etcd when running {verify,update}-openapi-spec.sh
This commit is contained in:
@@ -144,38 +144,42 @@ kube::etcd::cleanup() {
|
||||
}
|
||||
|
||||
kube::etcd::install() {
|
||||
(
|
||||
local os
|
||||
local arch
|
||||
local os
|
||||
local arch
|
||||
|
||||
os=$(kube::util::host_os)
|
||||
arch=$(kube::util::host_arch)
|
||||
os=$(kube::util::host_os)
|
||||
arch=$(kube::util::host_arch)
|
||||
|
||||
cd "${KUBE_ROOT}/third_party" || return 1
|
||||
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
|
||||
kube::log::info "etcd v${ETCD_VERSION} already installed. To use:"
|
||||
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""
|
||||
return #already installed
|
||||
fi
|
||||
|
||||
if [[ ${os} == "darwin" ]]; then
|
||||
download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.zip"
|
||||
url="https://github.com/etcd-io/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}-${os}-${arch}" etcd
|
||||
rm "${download_file}"
|
||||
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}-${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:"
|
||||
cd "${KUBE_ROOT}/third_party" || return 1
|
||||
if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
|
||||
kube::log::info "etcd v${ETCD_VERSION} already installed. To use:"
|
||||
kube::log::info "export PATH=\"$(pwd)/etcd:\${PATH}\""
|
||||
)
|
||||
# export into current process
|
||||
PATH="$(pwd)/etcd:${PATH}"
|
||||
export PATH
|
||||
return #already installed
|
||||
fi
|
||||
|
||||
if [[ ${os} == "darwin" ]]; then
|
||||
download_file="etcd-v${ETCD_VERSION}-${os}-${arch}.zip"
|
||||
url="https://github.com/etcd-io/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}-${os}-${arch}" etcd
|
||||
rm "${download_file}"
|
||||
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}-${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}\""
|
||||
# export into current process
|
||||
PATH="$(pwd)/etcd:${PATH}"
|
||||
export PATH
|
||||
}
|
||||
|
Reference in New Issue
Block a user