summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-03-13 14:06:54 +1100
committerTiger <twatson@gitlab.com>2019-03-20 12:04:46 +1100
commit89b0bc04b9927abc85ce5fc3735438f956a8d5a2 (patch)
tree29355d49ce1a784b4695b4897880c6fe2879d353 /app
parent759dab5b69f53a861045ebbc84836f83c7502af2 (diff)
downloadgitlab-ce-89b0bc04b9927abc85ce5fc3735438f956a8d5a2.tar.gz
Create one Kubernetes namespace for a deployment
Instead of creating a Kubernetes namespace on every cluster related to a project, only create one on the cluster the project is about to be deployed to.
Diffstat (limited to 'app')
-rw-r--r--app/models/deployment.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 811e623b7f7..428edfd88de 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -78,6 +78,10 @@ class Deployment < ActiveRecord::Base
Commit.truncate_sha(sha)
end
+ def cluster
+ project.deployment_platform(environment: environment.name)&.cluster
+ end
+
def last?
self == environment.last_deployment
end