Include double brackets to avoid parser issues

This commit is contained in:
Rodrigo Brito 2019-05-30 14:15:32 -03:00
parent a5776c44e9
commit 9cf2f0c0e9
1 changed files with 6 additions and 6 deletions

View File

@ -1,27 +1,27 @@
#!/bin/bash #!/bin/bash
if [ -z ${PLUGIN_NAMESPACE} ]; then if [[ -z ${PLUGIN_NAMESPACE} ]]; then
PLUGIN_NAMESPACE="default" PLUGIN_NAMESPACE="default"
fi fi
if [ -z ${PLUGIN_KUBERNETES_USER} ]; then if [[ -z ${PLUGIN_KUBERNETES_USER} ]]; then
PLUGIN_KUBERNETES_USER="default" PLUGIN_KUBERNETES_USER="default"
fi fi
if [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then if [[ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]]; then
KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN
fi fi
if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then if [[ ! -z ${PLUGIN_KUBERNETES_SERVER} ]]; then
KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER
fi fi
if [ ! -z ${PLUGIN_KUBERNETES_CERT} ]; then if [[ ! -z ${PLUGIN_KUBERNETES_CERT} ]]; then
KUBERNETES_CERT=${PLUGIN_KUBERNETES_CERT} KUBERNETES_CERT=${PLUGIN_KUBERNETES_CERT}
fi fi
kubectl config set-credentials default --token=${KUBERNETES_TOKEN} kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
if [ ! -z ${KUBERNETES_CERT} ]; then if [[ ! -z ${KUBERNETES_CERT} ]]; then
echo ${KUBERNETES_CERT} | base64 -d > ca.crt echo ${KUBERNETES_CERT} | base64 -d > ca.crt
kubectl config set-cluster default --server=${KUBERNETES_SERVER} --certificate-authority=ca.crt kubectl config set-cluster default --server=${KUBERNETES_SERVER} --certificate-authority=ca.crt
else else