diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-04-30 13:31:47 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-04-30 13:31:47 +0000 |
commit | 56c8b35b8460dac53e6d29c3c811da4e57eca66c (patch) | |
tree | 566efb71c8385a474c8ca08e4401a2782067557e /app/models | |
parent | ac2c2be97f1a0647630646ebf1e25f9bb0fb5ac9 (diff) | |
parent | b389ef66d46219abbd671bcdbdfdd2fb142798b8 (diff) | |
download | gitlab-ce-56c8b35b8460dac53e6d29c3c811da4e57eca66c.tar.gz |
Merge branch 'pl-fix-k8s-ns-query-variables' into 'master'
Use correct k8s namespace in Prometheus queries
See merge request gitlab-org/gitlab-ce!27812
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/clusters/platforms/kubernetes.rb | 4 | ||||
-rw-r--r-- | app/models/project_services/kubernetes_service.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index a806367a49b..ca7d109d4f0 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -76,6 +76,10 @@ module Clusters end end + def namespace_for(project) + cluster.find_or_initialize_kubernetes_namespace_for_project(project).namespace + end + def predefined_variables(project:) Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'KUBE_URL', value: api_url) diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index f650dbd3726..fc8afa9bead 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -94,6 +94,10 @@ class KubernetesService < DeploymentService end end + def namespace_for(project) + actual_namespace + end + # Check we can connect to the Kubernetes API def test(*args) kubeclient = build_kube_client! |