2017-02-08 06:04:53 +00:00
|
|
|
#!/bin/bash
|
2017-01-13 10:07:48 +00:00
|
|
|
|
2017-01-16 02:00:29 +00:00
|
|
|
if [ -z ${PLUGIN_NAMESPACE} ]; then
|
|
|
|
PLUGIN_NAMESPACE="default"
|
|
|
|
fi
|
|
|
|
|
2017-02-08 02:49:32 +00:00
|
|
|
if [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then
|
|
|
|
KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN
|
2017-02-20 09:22:24 +00:00
|
|
|
kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
|
2017-02-07 06:09:44 +00:00
|
|
|
fi
|
|
|
|
|
2017-02-08 02:49:32 +00:00
|
|
|
if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then
|
|
|
|
KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER
|
2017-02-07 06:09:44 +00:00
|
|
|
fi
|
|
|
|
|
2017-02-20 09:22:24 +00:00
|
|
|
if [ ! -z ${PLUGIN_KUBERNETES_CERT} ]; then
|
2017-02-20 09:30:53 +00:00
|
|
|
echo ${PLUGIN_KUBERNETES_CERT} | base64 -d > ca.crt
|
2017-02-20 09:22:24 +00:00
|
|
|
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
|
|
|
|
fi
|
|
|
|
|
2017-01-13 10:07:48 +00:00
|
|
|
kubectl config set-context default --cluster=default --user=default
|
|
|
|
kubectl config use-context default
|
2017-02-08 05:45:22 +00:00
|
|
|
|
2017-02-08 07:55:51 +00:00
|
|
|
IFS=',' read -r -a DEPLOYMENTS <<< "$PLUGIN_DEPLOYMENT"
|
2017-02-08 06:22:54 +00:00
|
|
|
for DEPLOY in ${DEPLOYMENTS[@]}; do
|
2017-02-08 07:39:11 +00:00
|
|
|
echo Deploying to $KUBERNETES_SERVER
|
2017-02-08 05:45:22 +00:00
|
|
|
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
|
|
|
|
${PLUGIN_CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG}
|
|
|
|
done
|