Skip to content

Commit

Permalink
Merge pull request kubernetes#44396 from wongma7/etcd-version
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Do etcd semver validation using posix only

this is a follow-up to kubernetes#44352, can't use sort -V because not everybody has that
```release-note
NONE
```
  • Loading branch information
Kubernetes Submit Queue authored Apr 13, 2017
2 parents 7a20c56 + 04241a6 commit c814bab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hack/lib/etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,23 @@ 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 [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$version" ]]; then
if [[ $(kube::etcd::version $ETCD_VERSION) -gt $(kube::etcd::version $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 [[ "`echo -e "${version}\n${ETCD_VERSION}" | sort -rV | head -n 1`" != "$version" ]]; then
if [[ $(kube::etcd::version $ETCD_VERSION) -gt $(kube::etcd::version $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
fi
fi
}

kube::etcd::version() {
printf '%s\n' "${@}" | awk -F . '{ printf("%d%03d%03d\n", $1, $2, $3) }'
}

kube::etcd::start() {
# validate before running
kube::etcd::validate
Expand Down

0 comments on commit c814bab

Please sign in to comment.