2018-08-03 13:22:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-04 17:35:41 -05:00
|
|
|
module DeploymentPlatform
|
2018-03-21 10:59:40 -04:00
|
|
|
# EE would override this and utilize environment argument
|
2018-03-26 18:14:23 -04:00
|
|
|
# rubocop:disable Gitlab/ModuleWithInstanceVariables
|
2018-03-07 05:14:25 -05:00
|
|
|
def deployment_platform(environment: nil)
|
2018-03-26 18:14:23 -04:00
|
|
|
@deployment_platform ||= {}
|
|
|
|
|
|
|
|
@deployment_platform[environment] ||= find_deployment_platform(environment)
|
2018-01-04 17:35:41 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-03-26 18:14:23 -04:00
|
|
|
def find_deployment_platform(environment)
|
2019-07-16 19:37:34 -04:00
|
|
|
find_platform_kubernetes_with_cte(environment) ||
|
2019-06-27 08:29:19 -04:00
|
|
|
find_instance_cluster_platform_kubernetes(environment: environment)
|
2018-03-26 18:14:23 -04:00
|
|
|
end
|
|
|
|
|
2019-07-08 02:03:09 -04:00
|
|
|
# EE would override this and utilize environment argument
|
|
|
|
def find_platform_kubernetes_with_cte(_environment)
|
|
|
|
Clusters::ClustersHierarchy.new(self).base_and_ancestors
|
|
|
|
.enabled.default_environment
|
|
|
|
.first&.platform_kubernetes
|
|
|
|
end
|
|
|
|
|
2019-04-17 22:45:31 -04:00
|
|
|
# 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-01-04 17:35:41 -05:00
|
|
|
end
|