From cf97aeeb83080fad1d718059dadd139441b3e0bb Mon Sep 17 00:00:00 2001
From: Pierre Riteau <pierre@stackhpc.com>
Date: Tue, 21 Jul 2020 09:38:49 +0200
Subject: [PATCH] Configure prometheus-openstack-exporter to use internal
 endpoints

Change-Id: Ia134a518b63bb59cfad631cc488181f5245160e6
---
 ansible/group_vars/all.yml                          |  1 +
 .../templates/prometheus-openstack-exporter.json.j2 |  2 +-
 ...ack-exporter-endpoint-type-7c687da172986fb3.yaml | 13 +++++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/openstack-exporter-endpoint-type-7c687da172986fb3.yaml

diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 9c4a3b3b9a..7984fb4fa0 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -1024,6 +1024,7 @@ prometheus_openstack_exporter_interval: "60s"
 prometheus_elasticsearch_exporter_interval: "60s"
 prometheus_cmdline_extras:
 prometheus_ceph_mgr_exporter_endpoints: []
+prometheus_openstack_exporter_endpoint_type: "internal"
 
 ############
 # Vitrage
diff --git a/ansible/roles/prometheus/templates/prometheus-openstack-exporter.json.j2 b/ansible/roles/prometheus/templates/prometheus-openstack-exporter.json.j2
index 7f1c2a4972..75adef4a67 100644
--- a/ansible/roles/prometheus/templates/prometheus-openstack-exporter.json.j2
+++ b/ansible/roles/prometheus/templates/prometheus-openstack-exporter.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/opt/openstack-exporter/openstack-exporter --os-client-config=/etc/openstack/clouds.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_openstack_exporter_port }} default",
+    "command": "/opt/openstack-exporter/openstack-exporter --endpoint-type={{ prometheus_openstack_exporter_endpoint_type }} --os-client-config=/etc/openstack/clouds.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_openstack_exporter_port }} default",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/clouds.yml",
diff --git a/releasenotes/notes/openstack-exporter-endpoint-type-7c687da172986fb3.yaml b/releasenotes/notes/openstack-exporter-endpoint-type-7c687da172986fb3.yaml
new file mode 100644
index 0000000000..a485727271
--- /dev/null
+++ b/releasenotes/notes/openstack-exporter-endpoint-type-7c687da172986fb3.yaml
@@ -0,0 +1,13 @@
+---
+upgrade:
+  - |
+    The Prometheus OpenStack exporter now uses internal endpoints to
+    communicate with OpenStack services, to match the configuration of other
+    services deployed by Kolla Ansible. Using public endpoints can be retained
+    by setting the ``prometheus_openstack_exporter_endpoint_type`` variable to
+    ``public``.
+fixes:
+  - |
+    The Prometheus OpenStack exporter now uses internal endpoints to
+    communicate with OpenStack services, to match the configuration of other
+    services deployed by Kolla Ansible.
-- 
GitLab