Add namespace option

This commit is contained in:
Charles Martinot 2017-01-16 10:00:29 +08:00
parent 4490e740d3
commit 8d2432c6e8
2 changed files with 6 additions and 3 deletions

View File

@ -12,6 +12,7 @@ This pipeline will update the `my-deployment` deployment with the image tagged `
deployment: my-deployment
repo: myorg/myrepo
name: my-container
namespace: default
tag: ${DRONE_COMMIT_SHA:8}
## Required secrets

View File

@ -1,9 +1,11 @@
#!/bin/sh
if [ -z ${PLUGIN_NAMESPACE} ]; then
PLUGIN_NAMESPACE="default"
fi
kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
kubectl config set-context default --cluster=default --user=default
kubectl config use-context default
kubectl set image deployment/${PLUGIN_DEPLOYMENT} ${PLUGIN_NAME}=${PLUGIN_REPO}:${PLUGIN_TAG}
#TODO : Identify a good way to identify IMAGE_NAME and PLUGIN_DEPLOY_IMAGE
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${PLUGIN_DEPLOYMENT} ${PLUGIN_NAME}=${PLUGIN_REPO}:${PLUGIN_TAG}