summaryrefslogtreecommitdiff
path: root/app/models/clusters/cluster.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/cluster.rb')
-rw-r--r--app/models/clusters/cluster.rb31
1 files changed, 16 insertions, 15 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 7a61622b139..7855fb69bd6 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -37,18 +37,13 @@ module Clusters
has_one :platform_kubernetes, class_name: 'Clusters::Platforms::Kubernetes', inverse_of: :cluster, autosave: true
- 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_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'
has_many :kubernetes_namespaces
@@ -132,9 +127,15 @@ module Clusters
end
def applications
- APPLICATIONS.values.map do |application_class|
- public_send(application_class.association_name) || public_send("build_#{application_class.association_name}") # rubocop:disable GitlabSecurity/PublicSend
- end
+ [
+ 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
+ ]
end
def provider