From 8d2432c6e82533504fb4f53cb152f3d845af8cd1 Mon Sep 17 00:00:00 2001 From: Charles Martinot Date: Mon, 16 Jan 2017 10:00:29 +0800 Subject: [PATCH] Add namespace option --- README.md | 1 + update.sh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f3367b7..b7b335c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/update.sh b/update.sh index c2f5053..14b7970 100644 --- a/update.sh +++ b/update.sh @@ -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}