Merge pull request #44352 from wongma7/etcd-version

Automatic merge from submit-queue (batch tested with PRs 43304, 41427, 43490, 44352)

Fix etcd semver validation by using 'sort -V'

The old check would erroneously say e.g. v3.0.6 is greater than v3.0.17 which is obviously false. So hack/local-up-cluster.sh would be allowed to run and things would break because etcd does not meet the minimum. sort -V validates it correctly.
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-04-11 13:46:18 -07:00 committed by GitHub
commit c68ae58c93
1 changed files with 2 additions and 2 deletions

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