Commit f6fa8429 authored by Matija Čupić's avatar Matija Čupić

Extract installed cluster application scope to concern

parent e36b203f
...@@ -8,8 +8,6 @@ module Clusters ...@@ -8,8 +8,6 @@ module Clusters
default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION
scope :installed, -> { where(status: ::Clusters::Applications::Helm.state_machines[:status].states[:installed].value) }
def set_initial_status def set_initial_status
return unless not_installable? return unless not_installable?
......
...@@ -11,8 +11,6 @@ module Clusters ...@@ -11,8 +11,6 @@ module Clusters
default_value_for :ingress_type, :nginx default_value_for :ingress_type, :nginx
default_value_for :version, :nginx default_value_for :version, :nginx
scope :installed, -> { where(status: ::Clusters::Applications::Ingress.state_machines[:status].states[:installed].value) }
enum ingress_type: { enum ingress_type: {
nginx: 1 nginx: 1
} }
......
...@@ -13,8 +13,6 @@ module Clusters ...@@ -13,8 +13,6 @@ module Clusters
default_value_for :version, VERSION default_value_for :version, VERSION
scope :installed, -> { where(status: ::Clusters::Applications::Prometheus.state_machines[:status].states[:installed].value) }
state_machine :status do state_machine :status do
after_transition any => [:installed] do |application| after_transition any => [:installed] do |application|
application.cluster.projects.each do |project| application.cluster.projects.each do |project|
......
...@@ -14,8 +14,6 @@ module Clusters ...@@ -14,8 +14,6 @@ module Clusters
default_value_for :version, VERSION default_value_for :version, VERSION
scope :installed, -> { where(status: ::Clusters::Applications::Runner.state_machines[:status].states[:installed].value) }
def chart def chart
"#{name}/gitlab-runner" "#{name}/gitlab-runner"
end end
......
...@@ -4,6 +4,8 @@ module Clusters ...@@ -4,6 +4,8 @@ module Clusters
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
scope :installed, -> { where(status: self.state_machines[:status].states[:installed].value) }
state_machine :status, initial: :not_installable do state_machine :status, initial: :not_installable do
state :not_installable, value: -2 state :not_installable, value: -2
state :errored, value: -1 state :errored, value: -1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment