adds more verbosity
This commit is contained in:
parent
f546a27b4c
commit
6994a596ae
29
update.sh
29
update.sh
|
@ -5,38 +5,39 @@ if [ -z ${PLUGIN_NAMESPACE} ]; then
|
||||||
PLUGIN_NAMESPACE="default"
|
PLUGIN_NAMESPACE="default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then
|
|
||||||
KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_CLIENT_CERT} ]; then
|
|
||||||
KUBERNETES_CLIENT_CERT=$PLUGIN_KUBERNETES_CLIENT_CERT
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_CLIENT_KEY} ]; then
|
|
||||||
KUBERNETES_CLIENT_KEY=$PLUGIN_KUBERNETES_CLIENT_KEY
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then
|
if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then
|
||||||
KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER
|
KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER
|
||||||
|
else
|
||||||
|
echo "ERROR: kubernetes_server url not provided"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_CERT} ]; then
|
if [ ! -z ${PLUGIN_KUBERNETES_CERT} ]; then
|
||||||
KUBERNETES_CERT=${PLUGIN_KUBERNETES_CERT}
|
KUBERNETES_CERT=${PLUGIN_KUBERNETES_CERT}
|
||||||
|
else
|
||||||
|
echo "WARNING: kubernetes_server_cert not provided"
|
||||||
|
echo "Inscure connection to the cluster will be used."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${PLUGIN_KUBERNETES_USER} ]; then
|
if [ ! -z ${PLUGIN_KUBERNETES_USER} ]; then
|
||||||
KUBERNETES_USER=${PLUGIN_KUBERNETES_USER:-default}
|
KUBERNETES_USER=${PLUGIN_KUBERNETES_USER:-default}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${KUBERNETES_CLIENT_CERT} ] && [ ! -z ${KUBERNETES_CLIENT_KEY} ]; then
|
if [ ! -z ${PLUGIN_KUBERNETES_CLIENT_CERT} ] && [ ! -z ${PLUGIN_KUBERNETES_CLIENT_KEY} ]; then
|
||||||
|
KUBERNETES_CLIENT_CERT=$PLUGIN_KUBERNETES_CLIENT_CERT
|
||||||
|
KUBERNETES_CLIENT_KEY=$PLUGIN_KUBERNETES_CLIENT_KEY
|
||||||
echo "INFO: Setting client credentials with signed-certificate and key."
|
echo "INFO: Setting client credentials with signed-certificate and key."
|
||||||
echo ${KUBERNETES_CLIENT_CERT} | base64 -d > client.crt
|
echo ${KUBERNETES_CLIENT_CERT} | base64 -d > client.crt
|
||||||
echo ${KUBERNETES_CLIENT_KEY} | base64 -d > client.key
|
echo ${KUBERNETES_CLIENT_KEY} | base64 -d > client.key
|
||||||
kubectl config set-credentials ${KUBERNETES_USER} --client-certificate=client.crt --client-key=client.key
|
kubectl config set-credentials ${KUBERNETES_USER} --client-certificate=client.crt --client-key=client.key
|
||||||
else
|
elif [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then
|
||||||
|
KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN
|
||||||
echo "INFO: Setting client credentials with token."
|
echo "INFO: Setting client credentials with token."
|
||||||
kubectl config set-credentials ${KUBERNETES_USER} --token=${KUBERNETES_TOKEN}
|
kubectl config set-credentials ${KUBERNETES_USER} --token=${KUBERNETES_TOKEN}
|
||||||
|
else
|
||||||
|
echo "ERROR: Provide either of the following authentication params:"
|
||||||
|
echo "[1] kubernetes_token"
|
||||||
|
echo "[2] kubernetes_client_cert and kubernetes_client_key"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${KUBERNETES_CERT} ]; then
|
if [ ! -z ${KUBERNETES_CERT} ]; then
|
||||||
|
|
Loading…
Reference in New Issue