summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-04-02 07:45:52 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-04-02 07:45:52 +0000
commit45c009b8956f587f074b5e5136b51e5259dc29fe (patch)
tree0bcbf8393c8c6aeb6192201e6049602950cc435e /app
parent6b89ab116110f177ecb809adf429fe05f76e97f5 (diff)
parentb26913a30c608f81c44abece263da8d01faf0126 (diff)
downloadgitlab-ce-45c009b8956f587f074b5e5136b51e5259dc29fe.tar.gz
Merge branch '44291-usage-ping-for-kubernetes-integration' into 'master'
Resolve "Usage ping for Kubernetes integration" Closes #44291 See merge request gitlab-org/gitlab-ce!17922
Diffstat (limited to 'app')
-rw-r--r--app/models/clusters/cluster.rb4
-rw-r--r--app/models/clusters/concerns/application_status.rb2
2 files changed, 6 insertions, 0 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index bfdfc5ae6fe..77947d515c1 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -51,6 +51,10 @@ module Clusters
scope :enabled, -> { where(enabled: true) }
scope :disabled, -> { where(enabled: false) }
+ scope :user_provided, -> { where(provider_type: ::Clusters::Cluster.provider_types[:user]) }
+ scope :gcp_provided, -> { where(provider_type: ::Clusters::Cluster.provider_types[:gcp]) }
+ scope :gcp_installed, -> { gcp_provided.includes(:provider_gcp).where(cluster_providers_gcp: { status: ::Clusters::Providers::Gcp.state_machines[:status].states[:created].value }) }
+
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
def status_name
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb
index 7b7c8eac773..8f3eb75bfa9 100644
--- a/app/models/clusters/concerns/application_status.rb
+++ b/app/models/clusters/concerns/application_status.rb
@@ -4,6 +4,8 @@ module Clusters
extend ActiveSupport::Concern
included do
+ scope :installed, -> { where(status: self.state_machines[:status].states[:installed].value) }
+
state_machine :status, initial: :not_installable do
state :not_installable, value: -2
state :errored, value: -1