masakari: fix minor issues with instance monitor

* Don't generate masakari.conf for instance monitor
* Don't generate masakari-monitors.conf for API or engine
* Use a consistent name for dimensions -
  masakari_instancemonitor_dimensions
* Fix source code paths in dev mode

Change-Id: I551f93c9bf1ad6712b53c316074ae1df84e4352b
This commit is contained in:
Mark Goddard 2021-03-26 10:46:28 +00:00 committed by Radosław Piliszek
parent 0d153af87f
commit 0b0dd35837
4 changed files with 38 additions and 19 deletions

View File

@ -34,7 +34,7 @@ masakari_services:
image: "{{ masakari_monitors_image_full }}"
volumes: "{{ masakari_instancemonitor_default_volumes + masakari_instancemonitor_extra_volumes }}"
privileged: True
dimensions: "{{ masakari_monitors_dimensions }}"
dimensions: "{{ masakari_instancemonitor_dimensions }}"
####################
@ -64,7 +64,9 @@ masakari_monitors_image_full: "{{ masakari_monitors_image }}:{{ masakari_monitor
masakari_api_dimensions: "{{ default_container_dimensions }}"
masakari_engine_dimensions: "{{ default_container_dimensions }}"
masakari_monitors_dimensions: "{{ default_container_dimensions }}"
# NOTE(mgoddard): Allow masakari_monitors_dimensions for backwards
# compatibility.
masakari_instancemonitor_dimensions: "{{ masakari_monitors_dimensions | default(default_container_dimensions) }}"
masakari_extra_volumes: "{{ default_extra_volumes }}"
masakari_api_extra_volumes: "{{ masakari_extra_volumes }}"
@ -89,7 +91,7 @@ masakari_instancemonitor_default_volumes:
- "/etc/localtime:/etc/localtime:ro"
- "{{ '/etc/timezone:/etc/timezone:ro' if ansible_os_family == 'Debian' else '' }}"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari/masakari:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakari' if masakari_dev_mode | bool else '' }}"
- "{{ kolla_dev_repos_directory ~ '/masakari-monitors/masakarimonitors:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakarimonitors' if masakari_dev_mode | bool else '' }}"
####################
@ -114,7 +116,7 @@ masakari_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
masakari_dev_mode: "{{ kolla_dev_mode }}"
masakari_source_version: "{{ kolla_source_version }}"
masakari_monitors_git_repository: "{{ kolla_dev_repos_git }}/masakarimonitors"
masakari_monitors_git_repository: "{{ kolla_dev_repos_git }}/masakari-monitors"
masakari_monitors_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
masakari_monitors_dev_mode: "{{ kolla_dev_mode }}"
masakari_monitors_source_version: "{{ kolla_source_version }}"

View File

@ -11,6 +11,6 @@
become: true
git:
repo: "{{ masakarimonitors_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/masakarimonitors"
dest: "{{ kolla_dev_repos_directory }}/masakari-monitors"
update: "{{ masakarimonitors_dev_repos_pull }}"
version: "{{ masakarimonitors_source_version }}"

View File

@ -64,43 +64,48 @@
- name: Copying over masakari.conf
vars:
service: "{{ item.key }}"
service_name: "{{ item }}"
service: "{{ masakari_services[service_name] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/masakari.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/masakari.conf"
- "{{ node_custom_config }}/masakari/{{ item.key }}.conf"
- "{{ node_custom_config }}/masakari/{{ service_name }}.conf"
- "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/masakari.conf"
dest: "{{ node_config_directory }}/{{ service_name }}/masakari.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_items:
- masakari-api
- masakari-engine
notify:
- Restart {{ item.key }} container
- Restart {{ service_name }} container
- name: Copying over masakari-monitors.conf
vars:
service: "{{ item.key }}"
service_name: "{{ item }}"
service: "{{ masakari_services[service_name] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/masakari-monitors.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/masakari/{{ item.key }}.conf"
- "{{ node_custom_config }}/masakari/{{ service_name }}.conf"
- "{{ node_custom_config }}/masakari/masakari-monitors.conf"
- "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari-monitors.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/masakari-monitors.conf"
dest: "{{ node_config_directory }}/{{ service_name }}/masakari-monitors.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_items:
- masakari-instancemonitor
notify:
- Restart {{ item.key }} container
- Restart {{ service_name }} container
- name: Copying over wsgi-masakari file for services
vars:

View File

@ -0,0 +1,12 @@
---
fixes:
- |
Fixes an issue where ``masakari.conf`` was generated for the
``masakari-instancemonitor`` service but not used.
- |
Fixes an issue where ``masakari-monitors.conf`` was generated for the
``masakari-api`` and ``masakari-engine`` services but not used.
- |
Uses a consistent variable name for container dimensions for
``masakari-instancemonitor`` - ``masakari_instancemonitor_dimensions``.
The old name of ``masakari_monitors_dimensions`` is still supported.