Skip to content

Commit

Permalink
Merge pull request #518 from agrare/remove_prometheus_alert_buffer_gem
Browse files Browse the repository at this point in the history
Delete Prometheus Alerts MonitoringManager
  • Loading branch information
Fryguy authored Mar 4, 2024
2 parents 7d49378 + f7b87fe commit 02858d8
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 905 deletions.
38 changes: 8 additions & 30 deletions app/models/manageiq/providers/kubernetes/container_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ class ManageIQ::Providers::Kubernetes::ContainerManager < ManageIQ::Providers::C
DEFAULT_PORT = 6443
METRICS_ROLES = %w[prometheus].freeze

has_one :infra_manager,
:foreign_key => :parent_ems_id,
:class_name => "ManageIQ::Providers::Kubevirt::InfraManager",
:autosave => true,
:inverse_of => :parent_manager,
:dependent => :destroy

include HasInfraManagerMixin
include ManageIQ::Providers::Kubernetes::ContainerManager::Options

before_save :stop_event_monitor_queue_on_change, :stop_refresh_worker_queue_on_change
Expand All @@ -22,12 +30,6 @@ def allow_targeted_refresh?
true
end

def monitoring_manager_needed?
connection_configurations.roles.include?(
ManageIQ::Providers::Kubernetes::MonitoringManagerMixin::ENDPOINT_ROLE.to_s
)
end

supports :metrics do
_("No metrics endpoint has been added") unless metrics_endpoint_exists?
end
Expand All @@ -36,13 +38,6 @@ def metrics_endpoint_exists?
endpoints.where(:role => METRICS_ROLES).exists?
end

# See HasMonitoringManagerMixin
has_one :monitoring_manager,
:foreign_key => :parent_ems_id,
:class_name => "ManageIQ::Providers::Kubernetes::MonitoringManager",
:autosave => true,
:dependent => :destroy

def self.ems_type
@ems_type ||= "kubernetes".freeze
end
Expand Down Expand Up @@ -688,18 +683,6 @@ def self.verify_prometheus_credentials(hostname, port, options)
!!prometheus_connect(hostname, port, options)&.query(:query => "ALL")&.kind_of?(Hash)
end

def self.verify_prometheus_alerts_credentials(hostname, port, options)
!!module_parent::MonitoringManager.verify_credentials(
:url => raw_api_endpoint(hostname, port),
:path => options[:path] || "/topics/alerts",
:credentials => {:token => options[:bearer]},
:ssl => {
:verify => options.dig(:ssl_options, :verify_ssl) != OpenSSL::SSL::VERIFY_NONE,
:cert_store => options.dig(:ssl_options, :ca_file)
}
)
end

def self.kubevirt_connect(hostname, port, options)
ManageIQ::Providers::Kubevirt::InfraManager.raw_connect(:server => hostname, :port => port, :token => options[:bearer])
end
Expand Down Expand Up @@ -750,11 +733,6 @@ def verify_prometheus_credentials
client.prometheus_try_connect
end

def verify_prometheus_alerts_credentials
ensure_monitoring_manager
monitoring_manager.verify_credentials
end

def verify_kubevirt_credentials
ensure_infra_manager
options = {
Expand Down
100 changes: 0 additions & 100 deletions app/models/manageiq/providers/kubernetes/monitoring_manager.rb

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 02858d8

Please sign in to comment.