debian-mirror-gitlab/app/models/concerns/deployment_platform.rb

32 lines
1,011 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module DeploymentPlatform
2018-05-01 15:08:00 +05:30
# EE would override this and utilize environment argument
# rubocop:disable Gitlab/ModuleWithInstanceVariables
2018-03-27 19:54:05 +05:30
def deployment_platform(environment: nil)
2018-05-01 15:08:00 +05:30
@deployment_platform ||= {}
@deployment_platform[environment] ||= find_deployment_platform(environment)
2018-03-17 18:26:18 +05:30
end
private
2018-05-01 15:08:00 +05:30
def find_deployment_platform(environment)
2019-09-30 21:07:59 +05:30
find_platform_kubernetes_with_cte(environment) ||
find_instance_cluster_platform_kubernetes(environment: environment)
2018-05-01 15:08:00 +05:30
end
# EE would override this and utilize environment argument
2019-09-30 21:07:59 +05:30
def find_platform_kubernetes_with_cte(_environment)
Clusters::ClustersHierarchy.new(self).base_and_ancestors
.enabled.default_environment
2019-02-15 15:39:39 +05:30
.first&.platform_kubernetes
end
2019-07-31 22:56:46 +05:30
# 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
2018-03-17 18:26:18 +05:30
end