Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/cluster.rb')
-rw-r--r--app/models/clusters/cluster.rb31
1 files changed, 15 insertions, 16 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 7855fb69bd6..7a61622b139 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -37,13 +37,18 @@ module Clusters
has_one :platform_kubernetes, class_name: 'Clusters::Platforms::Kubernetes', inverse_of: :cluster, autosave: true
- has_one :application_helm, class_name: 'Clusters::Applications::Helm'
- has_one :application_ingress, class_name: 'Clusters::Applications::Ingress'
- has_one :application_cert_manager, class_name: 'Clusters::Applications::CertManager'
- has_one :application_prometheus, class_name: 'Clusters::Applications::Prometheus'
- has_one :application_runner, class_name: 'Clusters::Applications::Runner'
- has_one :application_jupyter, class_name: 'Clusters::Applications::Jupyter'
- has_one :application_knative, class_name: 'Clusters::Applications::Knative'
+ def self.has_one_cluster_application(name) # rubocop:disable Naming/PredicateName
+ application = APPLICATIONS[name.to_s]
+ has_one application.association_name, class_name: application.to_s # rubocop:disable Rails/ReflectionClassName
+ end
+
+ has_one_cluster_application :helm
+ has_one_cluster_application :ingress
+ has_one_cluster_application :cert_manager
+ has_one_cluster_application :prometheus
+ has_one_cluster_application :runner
+ has_one_cluster_application :jupyter
+ has_one_cluster_application :knative
has_many :kubernetes_namespaces
@@ -127,15 +132,9 @@ module Clusters
end
def applications
- [
- application_helm || build_application_helm,
- application_ingress || build_application_ingress,
- application_cert_manager || build_application_cert_manager,
- application_prometheus || build_application_prometheus,
- application_runner || build_application_runner,
- application_jupyter || build_application_jupyter,
- application_knative || build_application_knative
- ]
+ APPLICATIONS.values.map do |application_class|
+ public_send(application_class.association_name) || public_send("build_#{application_class.association_name}") # rubocop:disable GitlabSecurity/PublicSend
+ end
end
def provider