diff options
-rw-r--r-- | app/services/clusters/gcp/finalize_creation_service.rb | 12 | ||||
-rw-r--r-- | spec/services/clusters/gcp/finalize_creation_service_spec.rb | 6 |
2 files changed, 8 insertions, 10 deletions
diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 3df43657fa0..9efe8d85dee 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -12,7 +12,8 @@ module Clusters create_gitlab_service_account! configure_kubernetes cluster.save! - configure_project_service_account + + ClusterPlatformConfigureWorker.perform_async(cluster.id) rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e provider.make_errored!("Failed to request to CloudPlatform; #{e.message}") @@ -55,15 +56,6 @@ module Clusters ).execute end - def configure_project_service_account - kubernetes_namespace = cluster.find_or_initialize_kubernetes_namespace(cluster.cluster_project) - - Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService.new( - cluster: cluster, - kubernetes_namespace: kubernetes_namespace - ).execute - end - def authorization_type create_rbac_cluster? ? 'rbac' : 'abac' end diff --git a/spec/services/clusters/gcp/finalize_creation_service_spec.rb b/spec/services/clusters/gcp/finalize_creation_service_spec.rb index efee158739d..cb8f4bd32c8 100644 --- a/spec/services/clusters/gcp/finalize_creation_service_spec.rb +++ b/spec/services/clusters/gcp/finalize_creation_service_spec.rb @@ -48,6 +48,12 @@ describe Clusters::Gcp::FinalizeCreationService, '#execute' do expect(kubernetes_namespace.service_account_name).to eq("#{namespace}-service-account") expect(kubernetes_namespace.service_account_token).to be_present end + + it 'calls ClusterPlatformConfigureWorker in a ascync fashion' do + expect(ClusterPlatformConfigureWorker).to receive(:perform_async).with(cluster.id) + + subject + end end shared_examples 'error' do |