gitlab-org--gitlab-foss/app/services/prometheus/adapter_service.rb
James Fargher 398c0e48f7 Remove now unused KubernetesService methods
Now that KubernetesService can no longer be a DeploymentPlatform we can
remove all kubernetes client code and KubernetesService edge cases.
2019-07-05 06:41:07 +12:00

35 lines
1,004 B
Ruby

# frozen_string_literal: true
module Prometheus
class AdapterService
def initialize(project, deployment_platform = nil)
@project = project
@deployment_platform = if deployment_platform
deployment_platform
else
project.deployment_platform
end
end
attr_reader :deployment_platform, :project
def prometheus_adapter
@prometheus_adapter ||= if service_prometheus_adapter.can_query?
service_prometheus_adapter
else
cluster_prometheus_adapter
end
end
def service_prometheus_adapter
project.find_or_initialize_service('prometheus')
end
def cluster_prometheus_adapter
application = deployment_platform&.cluster&.application_prometheus
application if application&.available?
end
end
end