Skip to content

Commit 19d4be7

Browse files
Merge pull request #12 from codefresh-io/SAAS-532-bug-fix-kubectl-version-check
Fixing method to check kubectl version to use
2 parents ffbdc1c + be3b044 commit 19d4be7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cf-deploy-kubernetes.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ else
3838
fi
3939

4040
#check the cluster version and decide which version of kubectl to use:
41-
SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -c18-20 | tr -d .)
42-
43-
if (( "$SERVER_VERSION" <= "16" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null
41+
SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -d ':' -f2 | cut -d '.' -f2 | sed 's/[^0-9]*//g')
42+
echo "Server minor version: $SERVER_VERSION"
43+
if (( "$SERVER_VERSION" <= "6" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null
4444

4545

4646
[ ! -f "${deployment_file}" ] && echo "Couldn't find $deployment_file file at $(pwd)" && exit 1;

0 commit comments

Comments
 (0)