gitlab-org--gitlab-foss/app/services/clusters/applications/install_service.rb

33 lines
805 B
Ruby
Raw Normal View History

# 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!
install
end
private
def install
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
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: %{error_code}') % { error_code: e.error_code })
2019-03-06 06:50:39 -05:00
rescue StandardError => e
log_error(e)
app.make_errored!(_('Failed to install.'))
2017-11-02 13:55:02 -04:00
end
end
end
end