Fix config.json templates for Prometheus exporters

4 exporters prometheus-cadvisor, prometheus-elasticsearch-exporter,
prometheus-memcached-exporter and prometheus-node-exporter templates
JSON object for copying CA into containers in wrong JSON array.

Corrected this by moving the JSON object templating from
``permissions`` to ``config_files``.

Closes-Bug: #2104253
Change-Id: Ib633667ccb025c87da237894f0c9a5d793bc62f8
This commit is contained in:
Seunghun Lee 2025-03-26 13:00:22 +00:00
parent b285dfe82f
commit 6043614519
5 changed files with 51 additions and 32 deletions

@ -1,17 +1,20 @@
{
"command": "/opt/cadvisor --port={{ prometheus_cadvisor_port }} --log_dir=/var/log/kolla/prometheus{% if prometheus_cadvisor_cmdline_extras %} {{ prometheus_cadvisor_cmdline_extras }}{% endif %}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:prometheus",
"recurse": true
}{% if kolla_copy_ca_into_containers | bool %},
"config_files": [
{% if kolla_copy_ca_into_containers | bool %}
{
"source": "{{ container_config_directory }}/ca-certificates",
"dest": "/var/lib/kolla/share/ca-certificates",
"owner": "root",
"perm": "0600"
}{% endif %}
}
{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:prometheus",
"recurse": true
}
]
}

@ -1,17 +1,20 @@
{
"command": "/opt/elasticsearch_exporter/elasticsearch_exporter --es.uri http://{{ api_interface_address | put_address_in_context('url') }}:{{ opensearch_port }} --web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_elasticsearch_exporter_port }}{% if prometheus_elasticsearch_exporter_cmdline_extras %} {{ prometheus_elasticsearch_exporter_cmdline_extras }}{% endif %}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}{% if kolla_copy_ca_into_containers | bool %},
"config_files": [
{% if kolla_copy_ca_into_containers | bool %}
{
"source": "{{ container_config_directory }}/ca-certificates",
"dest": "/var/lib/kolla/share/ca-certificates",
"owner": "root",
"perm": "0600"
}{% endif %}
}
{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}
]
}

@ -1,17 +1,20 @@
{
"command": "/opt/memcached_exporter/memcached_exporter --web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_memcached_exporter_port }} --memcached.address {{ api_interface_address | put_address_in_context('url') }}:{{ memcached_port }}{% if prometheus_memcached_exporter_cmdline_extras %} {{ prometheus_memcached_exporter_cmdline_extras }}{% endif %}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}{% if kolla_copy_ca_into_containers | bool %},
"config_files": [
{% if kolla_copy_ca_into_containers | bool %}
{
"source": "{{ container_config_directory }}/ca-certificates",
"dest": "/var/lib/kolla/share/ca-certificates",
"owner": "root",
"perm": "0600"
}{% endif %}
}
{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}
]
}

@ -1,17 +1,20 @@
{
"command": "/opt/node_exporter/node_exporter --path.procfs /host/proc --path.sysfs /host/sys --path.rootfs /host --web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_node_exporter_port }}{% if prometheus_node_exporter_cmdline_extras %} {{ prometheus_node_exporter_cmdline_extras }}{% endif %}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}{% if kolla_copy_ca_into_containers | bool %},
"config_files": [
{% if kolla_copy_ca_into_containers | bool %}
{
"source": "{{ container_config_directory }}/ca-certificates",
"dest": "/var/lib/kolla/share/ca-certificates",
"owner": "root",
"perm": "0600"
}{% endif %}
}
{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}
]
}

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes a bug where prometheus-cadvisor, prometheus-elasticsearch-exporter,
prometheus-memcached-exporter, prometheus-node-exporter cannot start
because of bad templating of config.json
`LP#2104253 <https://bugs.launchpad.net/kolla-ansible/+bug/2104253>`__