summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2019-05-03 10:15:23 +1200
committerJames Fargher <proglottis@gmail.com>2019-05-07 08:37:04 +1200
commit0aeef7335f5adcaf345e24377e63b2221721b346 (patch)
tree2b74f22a61a1661b3d9508ce35799d8372420384 /app
parentc40a99a05842d0976dd1bca532fbc67c0ccee04d (diff)
downloadgitlab-ce-0aeef7335f5adcaf345e24377e63b2221721b346.tar.gz
Convert instance level clusters enabled to class method
Diffstat (limited to 'app')
-rw-r--r--app/models/clusters/instance.rb2
-rw-r--r--app/models/concerns/deployment_platform.rb6
-rw-r--r--app/policies/clusters/instance_policy.rb2
3 files changed, 3 insertions, 7 deletions
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