From a064ce452361da49df05948f23f2e756cd1032fe Mon Sep 17 00:00:00 2001 From: "KAVVA, JAGAN MOHAN REDDY (jk330k)" Date: Thu, 26 Dec 2019 07:37:18 -0600 Subject: [PATCH] Enforce the use of the correct kubectl client version Webhook integration with Openstack requires to match the same version as the server. This enhancement allows user to select a specific support version, or use the latest version, if desire to install. Change-Id: Ifdfb140b1c76216410bb64f648957a4fa25981fa --- jmphost/setup-access.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/jmphost/setup-access.sh b/jmphost/setup-access.sh index 649c5242..c24ca0a6 100755 --- a/jmphost/setup-access.sh +++ b/jmphost/setup-access.sh @@ -5,7 +5,7 @@ # settings to remotely connect to K8S cluster through Keystone authentication mechanism. -if [[ ${#} -lt 2 ]] ; then +if [[ ${#} -ne 3 ]] ; then echo "Abort - Usage $0 " exit 1 fi @@ -27,11 +27,18 @@ function _addSourceList() { # Install dependencies once function _installDep () { - # kubectl if [[ $1 == 'kubectl' ]] ; then echo "Installing [${1}] dependency required..." - apt-get install -y kubectl + read -p "Enter kubectl version in the form of vX.X.X or enter '1' to install latest:" KUBECTL_VERSION + + if [ "$KUBECTL_VERSION" != "1" ]; then + curl -SL https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl \ + -o /usr/bin/kubectl + chmod +x /usr/bin/kubectl + else + apt-get install -y kubectl + fi fi }