diff options
-rwxr-xr-x | scripts/review_apps/review-apps.sh | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh index 9455e462617..ac516528483 100755 --- a/scripts/review_apps/review-apps.sh +++ b/scripts/review_apps/review-apps.sh @@ -18,7 +18,9 @@ function previousDeployFailed() { local deploy="${1}" echoinfo "Checking for previous deployment of ${deploy}" true - helm status "${deploy}" >/dev/null 2>&1 + local tiller_host=$(tiller_service_host) + + helm status --host="${tiller_host}" "${deploy}" >/dev/null 2>&1 local status=$? # if `status` is `0`, deployment exists, has a status @@ -48,7 +50,9 @@ function delete() { echoinfo "Deleting release '$name'..." true - helm delete --purge "$name" + local tiller_host=$(tiller_service_host) + + helm delete --host="${tiller_host}" --purge "$name" } function cleanup() { @@ -131,6 +135,11 @@ function install_tiller() { fi } +function tiller_service_host() { + kubectl get svc -n "$TILLER_NAMESPACE" tiller-deploy \ + -o template --template="{{.spec.clusterIP}}:{{(index .spec.ports 0).port}}" +} + function install_external_dns() { local release_name="dns-gitlab-review-app" local domain @@ -139,10 +148,14 @@ function install_external_dns() { if ! deployExists "${KUBE_NAMESPACE}" "${release_name}" || previousDeployFailed "${release_name}" ; then echoinfo "Installing external-dns Helm chart" + + local tiller_host=$(tiller_service_host) + helm repo update helm install stable/external-dns \ -n "${release_name}" \ --namespace "${KUBE_NAMESPACE}" \ + --host="${tiller_host}" \ --set provider="aws" \ --set aws.secretKey="${REVIEW_APPS_AWS_SECRET_KEY}" \ --set aws.accessKey="${REVIEW_APPS_AWS_ACCESS_KEY}" \ @@ -172,11 +185,13 @@ function download_gitlab_chart() { tar -xjf gitlab.tar.bz2 cd "gitlab-${GITLAB_HELM_CHART_REF}" + local tiller_host=$(tiller_service_host) + echoinfo "Adding the gitlab repo to Helm..." - helm repo add gitlab https://charts.gitlab.io + helm repo add --host="${tiller_host}" gitlab https://charts.gitlab.io echoinfo "Building the gitlab chart's dependencies..." - helm dependency build . + helm dependency build --host="${tiller_host}" . } function deploy() { @@ -203,10 +218,13 @@ function deploy() { create_secret download_gitlab_chart + local tiller_host=$(tiller_service_host) + HELM_CMD=$(cat << EOF helm upgrade --install \ --wait \ --timeout 600 \ + --host="${tiller_host}" \ --set global.appConfig.enableUsagePing=false \ --set releaseOverride="$CI_ENVIRONMENT_SLUG" \ --set global.hosts.hostSuffix="$HOST_SUFFIX" \ @@ -215,7 +233,7 @@ HELM_CMD=$(cat << EOF --set prometheus.install=false \ --set global.ingress.configureCertmanager=false \ --set global.ingress.tls.secretName=tls-cert \ - --set global.ingress.annotations."external-dns\.alpha\.kubernetes\.io/ttl"="10" + --set global.ingress.annotations."external-dns\.alpha\.kubernetes\.io/ttl"="10" \ --set nginx-ingress.controller.service.enableHttp=false \ --set nginx-ingress.defaultBackend.resources.requests.memory=7Mi \ --set nginx-ingress.controller.resources.requests.memory=440M \ |