diff options
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/agents/group_authorization.rb | 2 | ||||
-rw-r--r-- | app/models/clusters/agents/project_authorization.rb | 2 | ||||
-rw-r--r-- | app/models/clusters/applications/runner.rb | 4 | ||||
-rw-r--r-- | app/models/clusters/cluster.rb | 8 | ||||
-rw-r--r-- | app/models/clusters/integrations/prometheus.rb | 7 |
5 files changed, 15 insertions, 8 deletions
diff --git a/app/models/clusters/agents/group_authorization.rb b/app/models/clusters/agents/group_authorization.rb index 28a711aaf17..58ba874ab53 100644 --- a/app/models/clusters/agents/group_authorization.rb +++ b/app/models/clusters/agents/group_authorization.rb @@ -3,6 +3,8 @@ module Clusters module Agents class GroupAuthorization < ApplicationRecord + include ::Clusters::Agents::AuthorizationConfigScopes + self.table_name = 'agent_group_authorizations' belongs_to :agent, class_name: 'Clusters::Agent', optional: false diff --git a/app/models/clusters/agents/project_authorization.rb b/app/models/clusters/agents/project_authorization.rb index f6d19086751..b9b44741936 100644 --- a/app/models/clusters/agents/project_authorization.rb +++ b/app/models/clusters/agents/project_authorization.rb @@ -3,6 +3,8 @@ module Clusters module Agents class ProjectAuthorization < ApplicationRecord + include ::Clusters::Agents::AuthorizationConfigScopes + self.table_name = 'agent_project_authorizations' belongs_to :agent, class_name: 'Clusters::Agent', optional: false diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index 7cef92ce81a..59a9251d6b7 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -3,7 +3,7 @@ module Clusters module Applications class Runner < ApplicationRecord - VERSION = '0.31.0' + VERSION = '0.34.0' self.table_name = 'clusters_applications_runners' @@ -70,7 +70,7 @@ module Clusters } if cluster.group_type? - attributes[:groups] = [group] + attributes[:runner_namespaces] = [::Ci::RunnerNamespace.new(namespace: group)] elsif cluster.project_type? attributes[:runner_projects] = [::Ci::RunnerProject.new(project: project)] end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index feac7bbc363..87afa9f9491 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -139,8 +139,6 @@ module Clusters scope :with_available_elasticstack, -> { joins(:application_elastic_stack).merge(::Clusters::Applications::ElasticStack.available) } scope :with_available_cilium, -> { joins(:application_cilium).merge(::Clusters::Applications::Cilium.available) } scope :distinct_with_deployed_environments, -> { joins(:environments).merge(::Deployment.success).distinct } - scope :preload_elasticstack, -> { preload(:integration_elastic_stack) } - scope :preload_environments, -> { preload(:environments) } scope :managed, -> { where(managed: true) } scope :with_persisted_applications, -> { eager_load(*APPLICATIONS_ASSOCIATIONS) } @@ -150,9 +148,7 @@ module Clusters scope :for_project_namespace, -> (namespace_id) { joins(:projects).where(projects: { namespace_id: namespace_id }) } scope :with_name, -> (name) { where(name: name) } - # with_application_prometheus scope is deprecated, and scheduled for removal - # in %14.0. See https://gitlab.com/groups/gitlab-org/-/epics/4280 - scope :with_application_prometheus, -> { includes(:application_prometheus).joins(:application_prometheus) } + scope :with_integration_prometheus, -> { includes(:integration_prometheus).joins(:integration_prometheus) } scope :with_project_http_integrations, -> (project_ids) do conditions = { projects: :alert_management_http_integrations } includes(conditions).joins(conditions).where(projects: { id: project_ids }) @@ -311,7 +307,7 @@ module Clusters end def kubeclient - platform_kubernetes.kubeclient if kubernetes? + platform_kubernetes&.kubeclient if kubernetes? end def elastic_stack_adapter diff --git a/app/models/clusters/integrations/prometheus.rb b/app/models/clusters/integrations/prometheus.rb index d745a49afc1..8b21fa351a3 100644 --- a/app/models/clusters/integrations/prometheus.rb +++ b/app/models/clusters/integrations/prometheus.rb @@ -14,6 +14,13 @@ module Clusters validates :cluster, presence: true validates :enabled, inclusion: { in: [true, false] } + # Periodically checked and kept up to date for Monitor demo projects + enum health_status: { + unknown: 0, + healthy: 1, + unhealthy: 2 + } + attr_encrypted :alert_manager_token, mode: :per_attribute_iv, key: Settings.attr_encrypted_db_key_base_32, |