diff --git a/app/models/clusters/instance.rb b/app/models/clusters/instance.rb index e83c2baad74..d8a888d53ba 100644 --- a/app/models/clusters/instance.rb +++ b/app/models/clusters/instance.rb @@ -10,7 +10,7 @@ module Clusters ::Feature.enabled?(feature, default_enabled: true) end - def instance_clusters_enabled? + def self.enabled? ::Feature.enabled?(:instance_clusters, default_enabled: true) end end diff --git a/app/models/concerns/deployment_platform.rb b/app/models/concerns/deployment_platform.rb index c2dafec1a54..9ac0d612db3 100644 --- a/app/models/concerns/deployment_platform.rb +++ b/app/models/concerns/deployment_platform.rb @@ -38,7 +38,7 @@ module DeploymentPlatform end def find_instance_cluster_platform_kubernetes_with_feature_guard(environment: nil) - return unless instance_clusters_enabled? + return unless Clusters::Instance.enabled? find_instance_cluster_platform_kubernetes(environment: environment) end @@ -49,10 +49,6 @@ module DeploymentPlatform .first&.platform_kubernetes end - def instance_clusters_enabled? - Feature.enabled?(:instance_clusters, default_enabled: true) - end - def find_kubernetes_service_integration services.deployment.reorder(nil).find_by(active: true) end diff --git a/app/policies/clusters/instance_policy.rb b/app/policies/clusters/instance_policy.rb index 0818a5b2604..e1045c85e6d 100644 --- a/app/policies/clusters/instance_policy.rb +++ b/app/policies/clusters/instance_policy.rb @@ -6,7 +6,7 @@ module Clusters condition(:has_clusters, scope: :subject) { clusterable_has_clusters? } condition(:can_have_multiple_clusters) { multiple_clusters_available? } - condition(:instance_clusters_enabled, scope: :subject) { @subject.instance_clusters_enabled? } + condition(:instance_clusters_enabled) { Instance.enabled? } rule { admin & instance_clusters_enabled }.policy do enable :read_cluster