Added parameters 'force' and 'user'

'force' to update image even with the same tag
'user' to use custom account
This commit is contained in:
Delfer 2018-04-06 13:39:06 +03:00 committed by Delfer
parent 36904ab9b6
commit a139168649
1 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,10 @@ if [ -z ${PLUGIN_NAMESPACE} ]; then
PLUGIN_NAMESPACE="default" PLUGIN_NAMESPACE="default"
fi fi
if [ -z ${PLUGIN_KUBERNETES_USER} ]; then
PLUGIN_KUBERNETES_USER="default"
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
@ -25,7 +29,7 @@ else
kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
fi fi
kubectl config set-context default --cluster=default --user=default kubectl config set-context default --cluster=default --user=${PLUGIN_KUBERNETES_USER}
kubectl config use-context default kubectl config use-context default
# kubectl version # kubectl version
@ -34,6 +38,10 @@ IFS=',' read -r -a CONTAINERS <<< "${PLUGIN_CONTAINER}"
for DEPLOY in ${DEPLOYMENTS[@]}; do for DEPLOY in ${DEPLOYMENTS[@]}; do
echo Deploying to $KUBERNETES_SERVER echo Deploying to $KUBERNETES_SERVER
for CONTAINER in ${CONTAINERS[@]}; do for CONTAINER in ${CONTAINERS[@]}; do
if [[ ${PLUGIN_FORCE} == "true" ]]; then
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG}FORCE
fi
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \ kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} --record ${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} --record
done done