summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2019-04-27 16:35:32 +0200
committerPeter Leitzen <pleitzen@gitlab.com>2019-04-29 12:21:15 +0200
commitde69a808a015514fa7e4451f406fcc3d73734919 (patch)
treea8d03e5d7ef25b4810a56e73aa452795b805ebc0 /lib
parentab9910f7a5fe4981b330c3886865397fd066108d (diff)
downloadgitlab-ce-de69a808a015514fa7e4451f406fcc3d73734919.tar.gz
Use correct k8s namespace in Prometheus queries
Before this commit the wrong namespace could have been used in Prometheus queries for group-level installations.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/prometheus/query_variables.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/prometheus/query_variables.rb b/lib/gitlab/prometheus/query_variables.rb
index 1cc85d4b4a6..dca09aef47d 100644
--- a/lib/gitlab/prometheus/query_variables.rb
+++ b/lib/gitlab/prometheus/query_variables.rb
@@ -4,9 +4,13 @@ module Gitlab
module Prometheus
module QueryVariables
def self.call(environment)
+ deployment_platform = environment.deployment_platform
+ namespace = deployment_platform&.namespace_for(environment.project) ||
+ deployment_platform&.actual_namespace || ''
+
{
ci_environment_slug: environment.slug,
- kube_namespace: environment.deployment_platform&.actual_namespace || '',
+ kube_namespace: namespace,
environment_filter: %{container_name!="POD",environment="#{environment.slug}"}
}
end