summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-04-30 13:31:47 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-04-30 13:31:47 +0000
commit56c8b35b8460dac53e6d29c3c811da4e57eca66c (patch)
tree566efb71c8385a474c8ca08e4401a2782067557e /app/models
parentac2c2be97f1a0647630646ebf1e25f9bb0fb5ac9 (diff)
parentb389ef66d46219abbd671bcdbdfdd2fb142798b8 (diff)
downloadgitlab-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.rb4
-rw-r--r--app/models/project_services/kubernetes_service.rb4
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!