diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-05 15:46:41 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-05 15:46:41 +0000 |
commit | 13b1508c3ed9887d9fcffdad66cbcf90b14eabd9 (patch) | |
tree | fb5c76469015186badbbb1af0c6375c4e4de2df4 /app/models/concerns | |
parent | 2ea6900882edb151bfb2ee4ef9733a9fc7b521f6 (diff) | |
parent | e3188eb13e3145e9bd4b123c304e43b18eeb1154 (diff) | |
download | gitlab-ce-13b1508c3ed9887d9fcffdad66cbcf90b14eabd9.tar.gz |
Merge branch '34758-deployment-cluster' into 'master'
Use group clusters when deploying (DeploymentPlatform)
See merge request gitlab-org/gitlab-ce!22308
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/deployment_platform.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/concerns/deployment_platform.rb b/app/models/concerns/deployment_platform.rb index e57a3383544..0107af5f8ec 100644 --- a/app/models/concerns/deployment_platform.rb +++ b/app/models/concerns/deployment_platform.rb @@ -13,6 +13,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_kubernetes_service_integration || build_cluster_and_deployment_platform end @@ -23,6 +24,18 @@ module DeploymentPlatform .last&.platform_kubernetes end + def find_group_cluster_platform_kubernetes_with_feature_guard(environment: nil) + return unless group_clusters_enabled? + + find_group_cluster_platform_kubernetes(environment: environment) + end + + # EE would override this and utilize environment argument + def find_group_cluster_platform_kubernetes(environment: nil) + Clusters::Cluster.enabled.default_environment.ancestor_clusters_for_clusterable(self) + .first&.platform_kubernetes + end + def find_kubernetes_service_integration services.deployment.reorder(nil).find_by(active: true) end |