Class: Clusters::Gcp::FinalizeCreationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/clusters/gcp/finalize_creation_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#providerObject (readonly)

Returns the value of attribute provider


6
7
8
# File 'app/services/clusters/gcp/finalize_creation_service.rb', line 6

def provider
  @provider
end

Instance Method Details

#execute(provider) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/clusters/gcp/finalize_creation_service.rb', line 8

def execute(provider)
  @provider = provider

  configure_provider
  create_gitlab_service_account!
  configure_kubernetes
  configure_pre_installed_knative if provider.knative_pre_installed?
  cluster.save!
rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e
  log_service_error(e.class.name, provider.id, e.message)
  provider.make_errored!(s_('ClusterIntegration|Failed to request to Google Cloud Platform: %{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 Google Kubernetes Engine Cluster: %{message}') % { message: e.message })
end