summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 18:08:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 18:08:58 +0000
commit1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch)
tree6f62715938a4b2b001705c51c697609a8e0850ae /app/finders
parentbcc77054ee9aefd1e332e04a4189390fd5a3112e (diff)
downloadgitlab-ce-1ca9950d5f890cd8f185e1eda158b969a7244fe2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/projects/serverless/functions_finder.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/finders/projects/serverless/functions_finder.rb b/app/finders/projects/serverless/functions_finder.rb
index 4e0b69f47e5..3b4ecbb5387 100644
--- a/app/finders/projects/serverless/functions_finder.rb
+++ b/app/finders/projects/serverless/functions_finder.rb
@@ -93,24 +93,32 @@ module Projects
.services
.select { |svc| svc["metadata"]["name"] == name }
- add_metadata(finder, services).first unless services.nil?
+ attributes = add_metadata(finder, services).first
+ next unless attributes
+
+ Gitlab::Serverless::Service.new(attributes)
end
end
def knative_services
services_finders.map do |finder|
- services = finder.services
+ attributes = add_metadata(finder, finder.services)
- add_metadata(finder, services) unless services.nil?
+ attributes&.map do |attributes|
+ Gitlab::Serverless::Service.new(attributes)
+ end
end
end
def add_metadata(finder, services)
+ return if services.nil?
+
add_pod_count = services.one?
services.each do |s|
s["environment_scope"] = finder.cluster.environment_scope
- s["cluster_id"] = finder.cluster.id
+ s["environment"] = finder.environment
+ s["cluster"] = finder.cluster
if add_pod_count
s["podcount"] = finder