Fix etcd semver validation by using 'sort -V'

This commit is contained in:
Matthew Wong 2017-04-11 14:19:30 -04:00
parent e58d3dbf06
commit 36d244f084

View File

@ -36,12 +36,12 @@ kube::etcd::validate() {
# validate installed version is at least equal to minimum
version=$(etcd --version | tail -n +1 | head -n 1 | cut -d " " -f 3)
if [[ "${version}" < "${ETCD_VERSION}" ]]; then
if [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$version" ]]; then
export PATH=$KUBE_ROOT/third_party/etcd:$PATH
hash etcd
echo $PATH
version=$(etcd --version | head -n 1 | cut -d " " -f 3)
if [[ "${version}" < "${ETCD_VERSION}" ]]; then
if [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$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/."
exit 1