]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fixing ceph-exporter prometheus's job section 50685/head
authorRedouane Kachach <rkachach@redhat.com>
Mon, 27 Mar 2023 10:56:58 +0000 (12:56 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Mon, 27 Mar 2023 11:16:03 +0000 (13:16 +0200)
Fixes: https://tracker.ceph.com/issues/59170
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/pybind/mgr/cephadm/templates/services/prometheus/prometheus.yml.j2
src/pybind/mgr/cephadm/tests/test_services.py

index acbda6b9911661ede5af28f3a92672027cf13b56..b56843994555e944e0e8a52b16b8cd3a5df45cdb 100644 (file)
@@ -89,9 +89,21 @@ scrape_configs:
 
 {% if ceph_exporter_sd_url %}
   - job_name: 'ceph-exporter'
+{% if secure_monitoring_stack %}
     honor_labels: true
+    scheme: https
+    tls_config:
+      ca_file: root_cert.pem
     http_sd_configs:
     - url: {{ ceph_exporter_sd_url }}
+      basic_auth:
+        username: {{ service_discovery_username }}
+        password: {{ service_discovery_password }}
       tls_config:
         ca_file: root_cert.pem
+{% else %}
+    honor_labels: true
+    http_sd_configs:
+    - url: {{ ceph_exporter_sd_url }}
+{% endif %}
 {% endif %}
index 8e37836c77b0bdb8d796ac590042454e25040f95..514646005992fac593139697362346508a051097 100644 (file)
@@ -528,8 +528,6 @@ class TestMonitoring:
                     honor_labels: true
                     http_sd_configs:
                     - url: http://[::1]:8765/sd/prometheus/sd-config?service=ceph-exporter
-                      tls_config:
-                        ca_file: root_cert.pem
                 """).lstrip()
 
                 _run_cephadm.assert_called_with(
@@ -650,8 +648,14 @@ class TestMonitoring:
 
                   - job_name: 'ceph-exporter'
                     honor_labels: true
+                    scheme: https
+                    tls_config:
+                      ca_file: root_cert.pem
                     http_sd_configs:
                     - url: https://[::1]:8765/sd/prometheus/sd-config?service=ceph-exporter
+                      basic_auth:
+                        username: admin
+                        password: fake_password
                       tls_config:
                         ca_file: root_cert.pem
                 """).lstrip()