Merge "Upgrade Prometheus to v3"

This commit is contained in:
Zuul 2025-04-24 08:36:11 +00:00 committed by Gerrit Code Review
commit 29aa79a5d3
3 changed files with 54 additions and 2 deletions

View File

@ -348,7 +348,7 @@ prometheus_blackbox_exporter_endpoints_custom: []
####################
prometheus_tag: "{{ openstack_tag }}"
prometheus_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ docker_image_name_prefix }}prometheus-v2-server"
prometheus_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ docker_image_name_prefix }}prometheus-server"
prometheus_server_tag: "{{ prometheus_tag }}"
prometheus_server_image_full: "{{ prometheus_server_image }}:{{ prometheus_server_tag }}"
@ -404,7 +404,7 @@ prometheus_server_default_volumes:
- "{{ node_config_directory }}/prometheus-server/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
- "prometheus_v2:/var/lib/prometheus"
- "prometheus:/var/lib/prometheus"
- "kolla_logs:/var/log/kolla/"
prometheus_mysqld_exporter_default_volumes:
- "{{ node_config_directory }}/prometheus-mysqld-exporter/:{{ container_config_directory }}/:ro"

View File

@ -1,6 +1,44 @@
---
- import_tasks: config.yml
# NOTE(mnasiadka): Remove me in 2025.2
- name: Check for the existence of Prometheus v2 container volume
become: true
stat:
path: "{{ container_engine_volumes_path }}/prometheus_v2/_data"
register: prometheus_v2_data
- name: Migrate Prometheus volume
when: prometheus_v2_data.stat.exists
block:
- name: Gracefully stop Prometheus
become: true
kolla_container:
name: "{{ prometheus_services['prometheus-server'].container_name }}"
action: "stop_and_remove_container"
common_options: "{{ docker_common_options }}"
ignore_missing: true
- name: Create new Prometheus v3 volume
become: true
kolla_container:
action: "create_volume"
name: "prometheus"
common_options: "{{ docker_common_options }}"
- name: Move _data from old to new volume
become: true
command: "mv {{ container_engine_volumes_path }}/prometheus_v2/_data {{ container_engine_volumes_path }}/prometheus/"
args:
removes: "{{ container_engine_volumes_path }}/prometheus_v2/_data"
- name: Remove old Prometheus v2 volume
become: true
kolla_container:
action: "remove_volume"
name: "prometheus_v2"
common_options: "{{ docker_common_options }}"
- import_tasks: check-containers.yml
- name: Flush handlers

View File

@ -0,0 +1,14 @@
---
features:
- |
Updates Prometheus version to v3.2.1.
upgrade:
- |
Prometheus will be upgraded from v2 to v3 - which introduces minor breaking
changes. Make sure there's version 2.5.5 or later running before attempting
an upgrade. Read the official migration guide for more details here:
https://prometheus.io/docs/prometheus/3.0/migration/. Container's name and
volume name change back to simply ``prometheus_server`` and ``prometheus``,
respectively. The upgrade preserves the old data from ``prometheus_v2``
volume, but will leave it behind if the volume name has been customised by
the operator.