summaryrefslogtreecommitdiff
path: root/app/services/ci/create_cluster_service.rb
blob: d01e167ecc35c83ad5d48dd49443c924869b3c46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Ci
  class CreateClusterService < BaseService
    def execute(access_token)
      params['gcp_machine_type'] ||= GoogleApi::CloudPlatform::Client::DEFAULT_MACHINE_TYPE

      project.create_cluster(
        params.merge(user: current_user,
                     gcp_token: access_token)).tap do |cluster|
        ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
      end
    end
  end
end