debian-mirror-gitlab/app/services/clusters/applications/prometheus_update_service.rb

39 lines
1 KiB
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
module Clusters
module Applications
2021-06-08 01:23:25 +05:30
# Deprecated, to be removed in %14.0 as part of https://gitlab.com/groups/gitlab-org/-/epics/4280
2020-04-22 19:07:51 +05:30
class PrometheusUpdateService < BaseHelmService
attr_accessor :project
def initialize(app, project)
super(app)
@project = project
end
def execute
2021-06-08 01:23:25 +05:30
raise NotImplementedError, 'Externally installed prometheus should not be modified!' unless app.managed_prometheus?
2020-04-22 19:07:51 +05:30
app.make_updating!
helm_api.update(patch_command(values))
::ClusterWaitForAppUpdateWorker.perform_in(::ClusterWaitForAppUpdateWorker::INTERVAL, app.name, app.id)
rescue ::Kubeclient::HttpError => ke
app.make_update_errored!("Kubernetes error: #{ke.message}")
rescue StandardError => e
app.make_update_errored!(e.message)
end
private
def values
PrometheusConfigService
.new(project, cluster, app)
.execute
.to_yaml
end
end
end
end