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
This commit is contained in:
KAVVA, JAGAN MOHAN REDDY (jk330k) 2019-12-26 07:37:18 -06:00 committed by Jagan Mohan Kavva
parent 48bb08ff94
commit a064ce4523

View File

@ -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 <SITE NAME> <USER_ID> <NAMESPACE>"
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
}