Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geosphere-deploy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cspp_geo
geosphere
geosphere-deploy
Commits
dee965b9
Verified
Commit
dee965b9
authored
4 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix GCP jobs to use a more generic helm based job template
parent
f49d090e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
admin/GCP_README.md
+4
-1
4 additions, 1 deletion
admin/GCP_README.md
ci_gcp/gitlab-ci.yaml
+8
-27
8 additions, 27 deletions
ci_gcp/gitlab-ci.yaml
helpers/helm_base.yaml
+10
-3
10 additions, 3 deletions
helpers/helm_base.yaml
with
22 additions
and
31 deletions
admin/GCP_README.md
+
4
−
1
View file @
dee965b9
...
@@ -35,7 +35,10 @@ Next, go to your GCP Console, click the menu in the upper-left and go to
...
@@ -35,7 +35,10 @@ Next, go to your GCP Console, click the menu in the upper-left and go to
"Project Settings". From there click on "Service Accounts" and then
"Project Settings". From there click on "Service Accounts" and then
"+ CREATE SERVICE ACCOUNT". Follow the instructions to create your service
"+ CREATE SERVICE ACCOUNT". Follow the instructions to create your service
account. To give your SA permission to create resources on your Kubernetes
account. To give your SA permission to create resources on your Kubernetes
cluster give it at least the "roles/container.developer" role. See
cluster give it at least the "roles/container.developer" role
(Kubernetes Engine Developer). Some helm charts may want to create resources
like "Roles" (for RBAC) which will require more permissions. One existing
role that includes these permissions is Kubernetes Engine Service Agent. See
https://cloud.google.com/iam/docs/understanding-roles#kubernetes-engine-roles
https://cloud.google.com/iam/docs/understanding-roles#kubernetes-engine-roles
for more information.
for more information.
...
...
This diff is collapsed.
Click to expand it.
ci_gcp/gitlab-ci.yaml
+
8
−
27
View file @
dee965b9
# This file is included as part of the main repository .gitlab-ci.yml file
# This file is included as part of the main repository .gitlab-ci.yml file
.gcloud_base
:
extends
:
.helm_based_job
before_script
:
-
export KUBECONFIG="/root/.kube/config"
-
gcloud --verbosity=debug auth activate-service-account "${GEOSPHERE_DEPLOY_GCP_SA_EMAIL}" --key-file="${GEOSPHERE_DEPLOY_GCP_SA_KEY}"
# If this produces a warning about not having permission make sure the SA
# has the project "Viewer" role. If it still produces a warning then try
# enabling this Cloud Resource Manager API. See admin/GCP_README.md
# for more information.
-
gcloud --verbosity=debug config set project "${GEOSPHERE_DEPLOY_GCP_PROJECT_NAME}"
-
gcloud --verbosity=debug container clusters get-credentials "${GEOSPHERE_DEPLOY_GCP_CLUSTER_NAME}" --zone "${GEOSPHERE_DEPLOY_GCP_ZONE_NAME}";
-
helm registry login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
# - helm repo add stable https://kubernetes-charts.storage.googleapis.com
# - helm repo update
rules
:
-
if
:
$CI_COMMIT_TAG !~ /^gcp-r[0-9]+_[0-9]+/
when
:
never
-
when
:
on_success
test gcp connection
:
test gcp connection
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
test
stage
:
test
# don't need any artifacts for this to run
# don't need any artifacts for this to run
dependencies
:
[]
dependencies
:
[]
...
@@ -32,7 +13,7 @@ test gcp connection:
...
@@ -32,7 +13,7 @@ test gcp connection:
fi
fi
gcp create geotiff storage
:
gcp create geotiff storage
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
create storage
stage
:
create storage
script
:
script
:
-
ns=$(./helpers/get_namespace.sh)
-
ns=$(./helpers/get_namespace.sh)
...
@@ -48,7 +29,7 @@ gcp create geotiff storage:
...
@@ -48,7 +29,7 @@ gcp create geotiff storage:
-
if
:
$CREATE_STORAGE
-
if
:
$CREATE_STORAGE
gcp create postgres storage
:
gcp create postgres storage
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
create storage
stage
:
create storage
script
:
script
:
-
ns=$(./helpers/get_namespace.sh)
-
ns=$(./helpers/get_namespace.sh)
...
@@ -63,7 +44,7 @@ gcp create postgres storage:
...
@@ -63,7 +44,7 @@ gcp create postgres storage:
-
if
:
$CREATE_STORAGE
-
if
:
$CREATE_STORAGE
gcp create shapefile storage
:
gcp create shapefile storage
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
create storage
stage
:
create storage
script
:
script
:
-
ns=$(./helpers/get_namespace.sh)
-
ns=$(./helpers/get_namespace.sh)
...
@@ -79,7 +60,7 @@ gcp create shapefile storage:
...
@@ -79,7 +60,7 @@ gcp create shapefile storage:
-
if
:
$CREATE_STORAGE
-
if
:
$CREATE_STORAGE
gcp deploy rabbit
:
gcp deploy rabbit
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
deploy infrastructure
stage
:
deploy infrastructure
script
:
script
:
-
./helpers/deploy_rabbitmq.sh ci_gcp
-
./helpers/deploy_rabbitmq.sh ci_gcp
...
@@ -96,7 +77,7 @@ gcp deploy rabbit:
...
@@ -96,7 +77,7 @@ gcp deploy rabbit:
-
if
:
$DEPLOY_RABBIT
-
if
:
$DEPLOY_RABBIT
gcp deploy postgres
:
gcp deploy postgres
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
deploy infrastructure
stage
:
deploy infrastructure
script
:
script
:
-
./helpers/deploy_postgis.sh ci_gcp
-
./helpers/deploy_postgis.sh ci_gcp
...
@@ -113,7 +94,7 @@ gcp deploy postgres:
...
@@ -113,7 +94,7 @@ gcp deploy postgres:
-
if
:
$DEPLOY_POSTGIS
-
if
:
$DEPLOY_POSTGIS
gcp deploy grb
:
gcp deploy grb
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
deploy GRB
stage
:
deploy GRB
script
:
script
:
-
ns=$(./helpers/get_namespace.sh)
-
ns=$(./helpers/get_namespace.sh)
...
@@ -169,7 +150,7 @@ gcp deploy mapcache:
...
@@ -169,7 +150,7 @@ gcp deploy mapcache:
-
when
:
on_success
-
when
:
on_success
gcp deploy client
:
gcp deploy client
:
extends
:
.
gcloud_base
extends
:
.
helm_based_job
stage
:
deploy Client
stage
:
deploy Client
script
:
script
:
-
ns=$(./helpers/get_namespace.sh)
-
ns=$(./helpers/get_namespace.sh)
...
...
This diff is collapsed.
Click to expand it.
helpers/helm_base.yaml
+
10
−
3
View file @
dee965b9
...
@@ -7,7 +7,14 @@
...
@@ -7,7 +7,14 @@
-
export HELM_EXPERIMENTAL_OCI="1"
-
export HELM_EXPERIMENTAL_OCI="1"
-
docker info
-
docker info
-
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
-
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
# - source ./helpers/shell_aliases.sh
# If this produces a warning about not having permission make sure the SA
# has the project "Viewer" role. If it still produces a warning then try
# enabling this Cloud Resource Manager API. See admin/GCP_README.md
# for more information.
-
if [[ $CI_COMMIT_TAG !~ /^gcp-r[0-9]+_[0-9]+/ ]]; then
export KUBECONFIG="/root/.kube/config";
gcloud --verbosity=debug auth activate-service-account "${GEOSPHERE_DEPLOY_GCP_SA_EMAIL}" --key-file="${GEOSPHERE_DEPLOY_GCP_SA_KEY}";
gcloud --verbosity=debug config set project "${GEOSPHERE_DEPLOY_GCP_PROJECT_NAME}";
gcloud --verbosity=debug container clusters get-credentials "${GEOSPHERE_DEPLOY_GCP_CLUSTER_NAME}" --zone "${GEOSPHERE_DEPLOY_GCP_ZONE_NAME}";
fi
-
helm registry login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
-
helm registry login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
# - helm repo add stable https://kubernetes-charts.storage.googleapis.com
# - helm repo update
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment