From be3b044615338cbc74da1e6f5d14d4d71f4b64e4 Mon Sep 17 00:00:00 2001 From: francisco-codefresh Date: Fri, 12 Oct 2018 11:05:51 -0600 Subject: [PATCH] Fixing method to check kubectl version to use --- cf-deploy-kubernetes.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cf-deploy-kubernetes.sh b/cf-deploy-kubernetes.sh index 5ab8a8d..cc34986 100755 --- a/cf-deploy-kubernetes.sh +++ b/cf-deploy-kubernetes.sh @@ -38,9 +38,9 @@ else fi #check the cluster version and decide which version of kubectl to use: -SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -c18-20 | tr -d .) - -if (( "$SERVER_VERSION" <= "16" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null +SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -d ':' -f2 | cut -d '.' -f2 | sed 's/[^0-9]*//g') +echo "Server minor version: $SERVER_VERSION" +if (( "$SERVER_VERSION" <= "6" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null [ ! -f "${deployment_file}" ] && echo "Couldn't find $deployment_file file at $(pwd)" && exit 1;