From 2b36948511009763d6a2b952e4d40e81c44dc670 Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Tue, 5 Mar 2024 14:46:29 -0500 Subject: [PATCH] Merge pull request #522 from agrare/fix_prometheus_proxy_host Fix prometheus http_proxy using 0.0.0.0:80 (cherry picked from commit 22d854f19458ea441000d47ecfc13c6e473faf72) --- app/models/manageiq/providers/kubernetes/container_manager.rb | 3 ++- .../metrics_capture/prometheus_client_mixin.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/container_manager.rb b/app/models/manageiq/providers/kubernetes/container_manager.rb index a4325b2ef1..1b53196581 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager.rb @@ -666,8 +666,9 @@ def self.prometheus_connect(hostname, port, options) credentials = {:token => options[:bearer]} ssl_options = options[:ssl_options] || {:verify_ssl => OpenSSL::SSL::VERIFY_NONE} + http_proxy_uri = options[:http_proxy] || VMDB::Util.http_proxy_uri.to_s prometheus_options = { - :http_proxy_uri => options[:http_proxy] || VMDB::Util.http_proxy_uri.to_s, + :http_proxy_uri => http_proxy_uri.presence, :verify_ssl => ssl_options[:verify_ssl], :ssl_cert_store => ssl_options[:ca_file], } diff --git a/app/models/manageiq/providers/kubernetes/container_manager/metrics_capture/prometheus_client_mixin.rb b/app/models/manageiq/providers/kubernetes/container_manager/metrics_capture/prometheus_client_mixin.rb index 76989becab..249f5c27de 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager/metrics_capture/prometheus_client_mixin.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager/metrics_capture/prometheus_client_mixin.rb @@ -36,7 +36,7 @@ def prometheus_options worker_class = ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCollectorWorker { - :http_proxy_uri => VMDB::Util.http_proxy_uri.to_s, + :http_proxy_uri => VMDB::Util.http_proxy_uri.to_s.presence, :verify_ssl => @ext_management_system.verify_ssl_mode(prometheus_endpoint), :ssl_cert_store => @ext_management_system.ssl_cert_store(prometheus_endpoint), :open_timeout => worker_class.worker_settings[:prometheus_open_timeout] || 5,