Commit 7143bd5b authored by Thong Kuah's avatar Thong Kuah
Browse files

scale() and delete()

No tests for now as we need deploy to work before we can test either of
those
parent 02dabe6c
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -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_