diff --git a/scripts/install-snapshot.sh b/scripts/install-snapshot.sh index 8ba636608..f6b6d35cf 100755 --- a/scripts/install-snapshot.sh +++ b/scripts/install-snapshot.sh @@ -84,30 +84,6 @@ function delete_snapshot_crd() { kubectl delete -f "${VOLUME_SNAPSHOT}" --ignore-not-found } -# parse the kubernetes version -# v1.17.2 -> kube_version 1 -> 1 (Major) -# v1.17.2 -> kube_version 2 -> 17 (Minor) -function kube_version() { - echo "${KUBE_VERSION}" | sed 's/^v//' | cut -d'.' -f"${1}" -} - -if ! get_kube_version=$(kubectl version --short) || - [[ -z "${get_kube_version}" ]]; then - echo "could not get Kubernetes server version" - echo "hint: check if you have specified the right host or port" - exit 1 -fi - -KUBE_VERSION=$(echo "${get_kube_version}" | grep "^Server Version" | cut -d' ' -f3) -KUBE_MAJOR=$(kube_version 1) -KUBE_MINOR=$(kube_version 2) - -# skip snapshot operation if kube version is less than 1.17.0 -if [[ "${KUBE_MAJOR}" -lt 1 ]] || [[ "${KUBE_MAJOR}" -eq 1 && "${KUBE_MINOR}" -lt 17 ]]; then - echo "skipping: Kubernetes server version is < 1.17.0" - exit 1 -fi - case "${1:-}" in install) install_snapshot_controller "$2" @@ -115,13 +91,9 @@ install) cleanup) cleanup_snapshot_controller "$2" ;; -delete-crd) - delete_snapshot_crd - ;; *) echo "usage:" >&2 echo " $0 install" >&2 echo " $0 cleanup" >&2 - echo " $0 delete-crd" >&2 ;; esac