Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
41259546
Commit
41259546
authored
Apr 03, 2020
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change `review` stage jobs to helm 3
- `review-deploy` - `review-stop-failed-deployment` - `review-stop`
parent
8fc3e503
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
44 deletions
+10
-44
.gitlab/ci/review.gitlab-ci.yml
.gitlab/ci/review.gitlab-ci.yml
+1
-2
scripts/review_apps/base-config.yaml
scripts/review_apps/base-config.yaml
+1
-2
scripts/review_apps/review-apps.sh
scripts/review_apps/review-apps.sh
+8
-40
No files found.
.gitlab/ci/review.gitlab-ci.yml
View file @
41259546
...
...
@@ -81,7 +81,7 @@ review-build-cng:
.review-workflow-base
:
extends
:
-
.default-retry
image
:
registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-
charts-build-base
image
:
registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-
helm3-kubectl1.14
variables
:
HOST_SUFFIX
:
"
${CI_ENVIRONMENT_SLUG}"
DOMAIN
:
"
-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN}"
...
...
@@ -113,7 +113,6 @@ review-deploy:
script
:
-
check_kube_domain
-
ensure_namespace
-
install_tiller
-
install_external_dns
-
download_chart
-
date
...
...
scripts/review_apps/base-config.yaml
View file @
41259546
...
...
@@ -146,8 +146,7 @@ prometheus:
install
:
false
redis
:
metrics
:
resources
:
enabled
:
false
enabled
:
false
resources
:
requests
:
cpu
:
100m
...
...
scripts/review_apps/review-apps.sh
View file @
41259546
...
...
@@ -7,7 +7,7 @@ function deploy_exists() {
echoinfo
"Checking if
${
release
}
exists in the
${
namespace
}
namespace..."
true
helm status
--
tiller-
namespace
"
${
namespace
}
"
"
${
release
}
"
>
/dev/null 2>&1
helm status
--namespace
"
${
namespace
}
"
"
${
release
}
"
>
/dev/null 2>&1
deploy_exists
=
$?
echoinfo
"Deployment status for
${
release
}
is
${
deploy_exists
}
"
...
...
@@ -20,15 +20,15 @@ function previous_deploy_failed() {
echoinfo
"Checking for previous deployment of
${
release
}
"
true
helm status
--
tiller-
namespace
"
${
namespace
}
"
"
${
release
}
"
>
/dev/null 2>&1
helm status
--namespace
"
${
namespace
}
"
"
${
release
}
"
>
/dev/null 2>&1
local
status
=
$?
# if `status` is `0`, deployment exists, has a status
if
[
$status
-eq
0
]
;
then
echoinfo
"Previous deployment found, checking status..."
deployment_status
=
$(
helm status
--
tiller-
namespace
"
${
namespace
}
"
"
${
release
}
"
|
grep
^STATUS |
cut
-d
' '
-f2
)
deployment_status
=
$(
helm status
--namespace
"
${
namespace
}
"
"
${
release
}
"
|
grep
^STATUS |
cut
-d
' '
-f2
)
echoinfo
"Previous deployment state:
${
deployment_status
}
"
if
[[
"
$deployment_status
"
==
"
FAILED"
||
"
$deployment_status
"
==
"PENDING_UPGRADE"
||
"
$deployment_status
"
==
"PENDING_INSTALL
"
]]
;
then
if
[[
"
$deployment_status
"
==
"
failed"
||
"
$deployment_status
"
==
"pending-upgrade"
||
"
$deployment_status
"
==
"pending-install
"
]]
;
then
status
=
0
;
else
status
=
1
;
...
...
@@ -58,7 +58,7 @@ function helm_delete_release() {
echoinfo
"Deleting Helm release '
${
release
}
'..."
true
helm
delete
--tiller-namespace
"
${
namespace
}
"
--purge
"
${
release
}
"
helm
uninstall
--namespace
"
${
namespace
}
"
"
${
release
}
"
}
function
kubectl_cleanup_release
()
{
...
...
@@ -148,35 +148,6 @@ function ensure_namespace() {
kubectl describe namespace
"
${
namespace
}
"
||
kubectl create namespace
"
${
namespace
}
"
}
function
install_tiller
()
{
local
namespace
=
"
${
KUBE_NAMESPACE
}
"
echoinfo
"Checking deployment/tiller-deploy status in the
${
namespace
}
namespace..."
true
echoinfo
"Initiating the Helm client..."
helm init
--client-only
# Set toleration for Tiller to be installed on a specific node pool
helm init
\
--tiller-namespace
"
${
namespace
}
"
\
--wait
\
--upgrade
\
--force-upgrade
\
--node-selectors
"app=helm"
\
--replicas
3
\
--override
"spec.template.spec.tolerations[0].key"
=
"dedicated"
\
--override
"spec.template.spec.tolerations[0].operator"
=
"Equal"
\
--override
"spec.template.spec.tolerations[0].value"
=
"helm"
\
--override
"spec.template.spec.tolerations[0].effect"
=
"NoSchedule"
kubectl rollout status
--namespace
"
${
namespace
}
"
--watch
"deployment/tiller-deploy"
if
!
helm version
--tiller-namespace
"
${
namespace
}
"
--debug
;
then
echo
"Failed to init Tiller."
return
1
fi
}
function
install_external_dns
()
{
local
namespace
=
"
${
KUBE_NAMESPACE
}
"
local
release
=
"dns-gitlab-review-app"
...
...
@@ -186,16 +157,14 @@ function install_external_dns() {
if
!
deploy_exists
"
${
namespace
}
"
"
${
release
}
"
||
previous_deploy_failed
"
${
namespace
}
"
"
${
release
}
"
;
then
echoinfo
"Installing external-dns Helm chart"
helm repo update
--tiller-namespace
"
${
namespace
}
"
helm repo update
# Default requested: CPU => 0, memory => 0
# Chart > 2.6.1 has a problem with AWS so we're pinning it for now.
# See https://gitlab.com/gitlab-org/gitlab/issues/37269 and https://github.com/kubernetes-sigs/external-dns/issues/1262
helm
install
stable/external-dns
\
--tiller-namespace
"
${
namespace
}
"
\
helm
install
"
${
release
}
"
bitnami/external-dns
\
--namespace
"
${
namespace
}
"
\
--version
'2.6.1'
\
--name
"
${
release
}
"
\
--set
provider
=
"aws"
\
--set
aws.credentials.secretKey
=
"
${
REVIEW_APPS_AWS_SECRET_KEY
}
"
\
--set
aws.credentials.accessKey
=
"
${
REVIEW_APPS_AWS_ACCESS_KEY
}
"
\
...
...
@@ -289,11 +258,10 @@ function deploy() {
HELM_CMD
=
$(
cat
<<
EOF
helm upgrade
\
--tiller-namespace="
${
namespace
}
"
\
--namespace="
${
namespace
}
"
\
--install
\
--wait
\
--timeout 900
\
--timeout 900
s
\
--set ci.branch="
${
CI_COMMIT_REF_NAME
}
"
\
--set ci.commit.sha="
${
CI_COMMIT_SHORT_SHA
}
"
\
--set ci.job.url="
${
CI_JOB_URL
}
"
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment