2018-07-16 12:31:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-02 13:55:02 -04:00
|
|
|
module Clusters
|
|
|
|
module Applications
|
|
|
|
class InstallService < BaseHelmService
|
|
|
|
def execute
|
|
|
|
return unless app.scheduled?
|
|
|
|
|
2019-03-06 06:50:39 -05:00
|
|
|
app.make_installing!
|
2019-04-10 02:38:27 -04:00
|
|
|
log_event(:begin_install)
|
2019-03-06 06:50:39 -05:00
|
|
|
helm_api.install(install_command)
|
2017-11-02 13:55:02 -04:00
|
|
|
|
2019-04-10 02:38:27 -04:00
|
|
|
log_event(:schedule_wait_for_installation)
|
2019-03-06 06:50:39 -05:00
|
|
|
ClusterWaitForAppInstallationWorker.perform_in(
|
|
|
|
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
|
|
|
|
rescue Kubeclient::HttpError => e
|
|
|
|
log_error(e)
|
|
|
|
app.make_errored!("Kubernetes error: #{e.error_code}")
|
|
|
|
rescue StandardError => e
|
|
|
|
log_error(e)
|
|
|
|
app.make_errored!("Can't start installation process.")
|
2017-11-02 13:55:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|