cluster_provision_worker.rb 428 Bytes
Newer Older
1 2
# frozen_string_literal: true

3
class ClusterProvisionWorker
4
  include ApplicationWorker
5
  include ClusterQueue
6 7

  def perform(cluster_id)
8
    Clusters::Cluster.find_by_id(cluster_id).try do |cluster|
Shinya Maeda's avatar
Shinya Maeda committed
9 10
      cluster.provider.try do |provider|
        Clusters::Gcp::ProvisionService.new.execute(provider) if cluster.gcp?
11
      end
12 13

      ClusterPlatformConfigureWorker.perform_async(cluster.id) if cluster.user?
14 15 16
    end
  end
end