summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-12-06 18:08:49 +0000
committerMike Greiling <mike@pixelcog.com>2018-12-06 18:08:49 +0000
commit2c80a1c0de07877e6e2bf7ab20de2d4f43a0d97c (patch)
treeafa7f5f54e2491e0c08168b6f4ce47511da3012b /app/finders
parente80f89337b4be31c5531448861cedb556d02c01e (diff)
downloadgitlab-ce-2c80a1c0de07877e6e2bf7ab20de2d4f43a0d97c.tar.gz
Introduce Knative Serverless Tab
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/projects/serverless/functions_finder.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/finders/projects/serverless/functions_finder.rb b/app/finders/projects/serverless/functions_finder.rb
new file mode 100644
index 00000000000..2b5d67e79d7
--- /dev/null
+++ b/app/finders/projects/serverless/functions_finder.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Projects
+ module Serverless
+ class FunctionsFinder
+ def initialize(clusters)
+ @clusters = clusters
+ end
+
+ def execute
+ knative_services.flatten.compact
+ end
+
+ def installed?
+ clusters_with_knative_installed.exists?
+ end
+
+ private
+
+ def knative_services
+ clusters_with_knative_installed.preload_knative.map do |cluster|
+ cluster.application_knative.services_for(ns: cluster.platform_kubernetes&.actual_namespace)
+ end
+ end
+
+ def clusters_with_knative_installed
+ @clusters.with_knative_installed
+ end
+ end
+ end
+end