diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-04-27 17:35:32 +0300 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-04-29 13:21:15 +0300 |
commit | de69a808a015514fa7e4451f406fcc3d73734919 (patch) | |
tree | a8d03e5d7ef25b4810a56e73aa452795b805ebc0 /lib | |
parent | ab9910f7a5fe4981b330c3886865397fd066108d (diff) |
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.rb | 6 |
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 |