Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2019-04-18 05:45:31 +0300
committerJames Fargher <proglottis@gmail.com>2019-05-06 23:37:03 +0300
commit8db382b05545fdef0a60bcff65f8c23e8b1ed282 (patch)
tree48c45052013b98a571ce73a6b2239a9ea050e414 /app/models/concerns/deployment_platform.rb
parent733da6d6a015e8c951dcc02250cfe1fab87789c0 (diff)
Allow projects to use instance level clusters
There are two cluster hierarchies one for the deployment platform and one for controllers. The main difference is that deployment platforms do not check user permissions and only return the first match.
Diffstat (limited to 'app/models/concerns/deployment_platform.rb')
-rw-r--r--app/models/concerns/deployment_platform.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/concerns/deployment_platform.rb b/app/models/concerns/deployment_platform.rb
index 0107af5f8ec..c2dafec1a54 100644
--- a/app/models/concerns/deployment_platform.rb
+++ b/app/models/concerns/deployment_platform.rb
@@ -14,6 +14,7 @@ module DeploymentPlatform
def find_deployment_platform(environment)
find_cluster_platform_kubernetes(environment: environment) ||
find_group_cluster_platform_kubernetes_with_feature_guard(environment: environment) ||
+ find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment) ||
find_kubernetes_service_integration ||
build_cluster_and_deployment_platform
end
@@ -36,6 +37,22 @@ module DeploymentPlatform
.first&.platform_kubernetes
end
+ def find_instance_cluster_platform_kubernetes_with_feature_guard(environment: nil)
+ return unless instance_clusters_enabled?
+
+ find_instance_cluster_platform_kubernetes(environment: environment)
+ end
+
+ # EE would override this and utilize environment argument
+ def find_instance_cluster_platform_kubernetes(environment: nil)
+ Clusters::Instance.new.clusters.enabled.default_environment
+ .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