2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module ClustersHelper
|
2018-12-13 13:39:08 +05:30
|
|
|
# EE overrides this
|
|
|
|
def has_multiple_clusters?
|
2018-03-17 18:26:18 +05:30
|
|
|
false
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
def create_new_cluster_label(provider: nil)
|
|
|
|
case provider
|
|
|
|
when 'aws'
|
2020-01-01 13:55:28 +05:30
|
|
|
s_('ClusterIntegration|Create new cluster on EKS')
|
2019-12-26 22:10:19 +05:30
|
|
|
when 'gcp'
|
2020-01-01 13:55:28 +05:30
|
|
|
s_('ClusterIntegration|Create new cluster on GKE')
|
2019-12-26 22:10:19 +05:30
|
|
|
else
|
2020-01-01 13:55:28 +05:30
|
|
|
s_('ClusterIntegration|Create new cluster')
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def new_cluster_partial(provider: nil)
|
|
|
|
case provider
|
|
|
|
when 'aws'
|
|
|
|
'clusters/clusters/aws/new'
|
|
|
|
when 'gcp'
|
|
|
|
'clusters/clusters/gcp/new'
|
|
|
|
else
|
|
|
|
'clusters/clusters/cloud_providers/cloud_provider_selector'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
def render_gcp_signup_offer
|
2018-11-08 19:23:39 +05:30
|
|
|
return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers?
|
2018-10-15 14:42:47 +05:30
|
|
|
return unless show_gcp_signup_offer?
|
|
|
|
|
|
|
|
content_tag :section, class: 'no-animate expanded' do
|
2018-12-13 13:39:08 +05:30
|
|
|
render 'clusters/clusters/gcp_signup_offer_banner'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
def has_rbac_enabled?(cluster)
|
|
|
|
return cluster.platform_kubernetes_rbac? if cluster.platform_kubernetes
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
cluster.provider.has_rbac_enabled?
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
ClustersHelper.prepend_if_ee('EE::ClustersHelper')
|