Class: Clusters::Aws::FinalizeCreationService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/clusters/aws/finalize_creation_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Attribute Details

#providerObject (readonly)

Returns the value of attribute provider


8
9
10
# File 'app/services/clusters/aws/finalize_creation_service.rb', line 8

def provider
  @provider
end

Instance Method Details

#execute(provider) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/services/clusters/aws/finalize_creation_service.rb', line 12

def execute(provider)
  @provider = provider

  configure_provider
  create_gitlab_service_account!
  configure_platform_kubernetes
  configure_node_authentication!

  cluster.save!
rescue ::Aws::CloudFormation::Errors::ServiceError => e
  log_service_error(e.class.name, provider.id, e.message)
  provider.make_errored!(s_('ClusterIntegration|Failed to fetch CloudFormation stack: %{message}') % { message: e.message })
rescue Kubeclient::HttpError => e
  log_service_error(e.class.name, provider.id, e.message)
  provider.make_errored!(s_('ClusterIntegration|Failed to run Kubeclient: %{message}') % { message: e.message })
rescue ActiveRecord::RecordInvalid => e
  log_service_error(e.class.name, provider.id, e.message)
  provider.make_errored!(s_('ClusterIntegration|Failed to configure EKS provider: %{message}') % { message: e.message })
end