From 5c69e4ff0924b2dd4146eb7fd4782c70d9709e8b Mon Sep 17 00:00:00 2001 From: Vincent De Smet Date: Mon, 20 Feb 2017 18:06:46 +0800 Subject: [PATCH] Fix logic for Cert usage --- update.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index d25ef27..838e2f8 100755 --- a/update.sh +++ b/update.sh @@ -6,7 +6,6 @@ fi if [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN - kubectl config set-credentials default --token=${KUBERNETES_TOKEN} fi if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then @@ -14,7 +13,12 @@ if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then fi if [ ! -z ${PLUGIN_KUBERNETES_CERT} ]; then - echo ${PLUGIN_KUBERNETES_CERT} | base64 -d > ca.crt + KUBERNETES_CERT=${PLUGIN_KUBERNETES_CERT} +fi + +kubectl config set-credentials default --token=${KUBERNETES_TOKEN} +if [ ! -z ${KUBERNETES_CERT} ]; then + echo ${KUBERNETES_CERT}} | base64 -d > ca.crt kubectl config set-cluster default --server=${KUBERNETES_SERVER} --certificate-authority=ca.crt else kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true @@ -22,7 +26,7 @@ fi kubectl config set-context default --cluster=default --user=default kubectl config use-context default - + IFS=',' read -r -a DEPLOYMENTS <<< "$PLUGIN_DEPLOYMENT" for DEPLOY in ${DEPLOYMENTS[@]}; do echo Deploying to $KUBERNETES_SERVER