From 7143bd5baf3695b58ceb60d2845491d5b5f819bd Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Fri, 5 Jul 2019 23:49:05 +1200 Subject: [PATCH] scale() and delete() No tests for now as we need deploy to work before we can test either of those --- src/deploy-helpers.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/deploy-helpers.sh b/src/deploy-helpers.sh index c9f1710..f09eec3 100755 --- a/src/deploy-helpers.sh +++ b/src/deploy-helpers.sh @@ -198,6 +198,35 @@ function deploy() { fi } +function scale() { + track="${1-stable}" + percentage="${2-100}" + name=$(deploy_name "$track") + + replicas=$(get_replicas "$track" "$percentage") + + if [[ -n "$(helm ls -q "^$name$")" ]]; then + helm upgrade --reuse-values \ + --wait \ + --set replicaCount="$replicas" \ + --namespace="$KUBE_NAMESPACE" \ + "$name" \ + chart/ + fi +} + +function delete() { + track="${1-stable}" + name=$(deploy_name "$track") + + if [[ -n "$(helm ls -q "^$name$")" ]]; then + helm delete --purge "$name" + fi + + secret_name=$(application_secret_name "$track") + kubectl delete secret --ignore-not-found -n "$KUBE_NAMESPACE" "$secret_name" +} + ## Helper functions # Extracts variables prefixed with K8S_SECRET_ -- GitLab