From 619ccf1242030031d2c79edb032823e08c1adff1 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Mon, 4 Nov 2019 22:13:01 -0800 Subject: [PATCH] Added senlin-conductor and senlin-health-manager Depends-On: https://review.opendev.org/692948/ Depends-On: https://review.opendev.org/692691/ Change-Id: I07827b896d36c3723697540fcff164224f6729af --- ansible/inventory/all-in-one | 6 ++++ ansible/inventory/multinode | 6 ++++ .../conf/filter/01-rewrite-0.12.conf.j2 | 2 +- .../conf/filter/01-rewrite-0.14.conf.j2 | 2 +- ansible/roles/senlin/defaults/main.yml | 36 +++++++++++++++++++ ansible/roles/senlin/handlers/main.yml | 30 ++++++++++++++++ ansible/roles/senlin/tasks/deploy.yml | 4 ++- .../senlin/templates/senlin-conductor.json.j2 | 24 +++++++++++++ .../templates/senlin-health-manager.json.j2 | 24 +++++++++++++ ansible/roles/senlin/templates/senlin.conf.j2 | 19 +++++++--- ansible/site.yml | 2 ++ ...-new-senlin-services-b53a9dc26453f947.yaml | 6 ++++ tests/templates/inventory.j2 | 6 ++++ 13 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 ansible/roles/senlin/templates/senlin-conductor.json.j2 create mode 100644 ansible/roles/senlin/templates/senlin-health-manager.json.j2 create mode 100644 releasenotes/notes/add-new-senlin-services-b53a9dc26453f947.yaml diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 2445019e92..c6720e6fc2 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -630,9 +630,15 @@ watcher [senlin-api:children] senlin +[senlin-conductor:children] +senlin + [senlin-engine:children] senlin +[senlin-health-manager:children] +senlin + # Searchlight [searchlight-api:children] searchlight diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index a3bf77aec7..887c394191 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -649,9 +649,15 @@ watcher [senlin-api:children] senlin +[senlin-conductor:children] +senlin + [senlin-engine:children] senlin +[senlin-health-manager:children] +senlin + # Searchlight [searchlight-api:children] searchlight diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 index c8c821b3a0..0b49f39832 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 @@ -21,7 +21,7 @@ rewriterule18 programname ^(trove-api|trove-conductor|trove-manage|trove-taskmanager)$ openstack_python rewriterule19 programname ^(congress-server)$ openstack_python rewriterule20 programname ^(murano-api|murano-engine)$ openstack_python - rewriterule21 programname ^(senlin-api|senlin-engine)$ openstack_python + rewriterule21 programname ^(senlin-api|senlin-conductor|senlin-engine|senlin-health-manager)$ openstack_python rewriterule22 programname ^(watcher-api|watcher-applier|watcher-db-manage|watcher-decision-engine)$ openstack_python rewriterule23 programname ^(freezer-api|freezer-api_access|freezer-manage)$ openstack_python rewriterule24 programname ^(octavia-api|octavia-health-manager|octavia-housekeeping|octavia-worker)$ openstack_python diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 index 8cafb7a721..363dbbcf68 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 @@ -108,7 +108,7 @@ key programname - pattern ^(senlin-api|senlin-engine)$ + pattern ^(senlin-api|senlin-conductor|senlin-engine|senlin-health-manager)$ tag openstack_python diff --git a/ansible/roles/senlin/defaults/main.yml b/ansible/roles/senlin/defaults/main.yml index 91bce201ae..25a4889761 100644 --- a/ansible/roles/senlin/defaults/main.yml +++ b/ansible/roles/senlin/defaults/main.yml @@ -22,6 +22,13 @@ senlin_services: external: true port: "{{ senlin_api_port }}" listen_port: "{{ senlin_api_listen_port }}" + senlin-conductor: + container_name: senlin_conductor + group: senlin-conductor + enabled: true + image: "{{ senlin_conductor_image_full }}" + volumes: "{{ senlin_conductor_default_volumes + senlin_conductor_extra_volumes }}" + dimensions: "{{ senlin_conductor_dimensions }}" senlin-engine: container_name: senlin_engine group: senlin-engine @@ -29,6 +36,13 @@ senlin_services: image: "{{ senlin_engine_image_full }}" volumes: "{{ senlin_engine_default_volumes + senlin_engine_extra_volumes }}" dimensions: "{{ senlin_engine_dimensions }}" + senlin-health-manager: + container_name: senlin_health_manager + group: senlin-health-manager + enabled: true + image: "{{ senlin_health_manager_image_full }}" + volumes: "{{ senlin_health_manager_default_volumes + senlin_health_manager_extra_volumes }}" + dimensions: "{{ senlin_health_manager_dimensions }}" #################### # Database @@ -44,31 +58,53 @@ senlin_database_address: "{{ database_address | put_address_in_context('url') }} senlin_install_type: "{{ kolla_install_type }}" senlin_tag: "{{ openstack_release }}" +senlin_conductor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ senlin_install_type }}-senlin-conductor" +senlin_conductor_tag: "{{ senlin_tag }}" +senlin_conductor_image_full: "{{ senlin_conductor_image }}:{{ senlin_conductor_tag }}" + senlin_engine_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ senlin_install_type }}-senlin-engine" senlin_engine_tag: "{{ senlin_tag }}" senlin_engine_image_full: "{{ senlin_engine_image }}:{{ senlin_engine_tag }}" +senlin_health_manager_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ senlin_install_type }}-senlin-health-manager" +senlin_health_manager_tag: "{{ senlin_tag }}" +senlin_health_manager_image_full: "{{ senlin_health_manager_image }}:{{ senlin_health_manager_tag }}" + senlin_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ senlin_install_type }}-senlin-api" senlin_api_tag: "{{ senlin_tag }}" senlin_api_image_full: "{{ senlin_api_image }}:{{ senlin_api_tag }}" senlin_api_dimensions: "{{ default_container_dimensions }}" +senlin_conductor_dimensions: "{{ default_container_dimensions }}" senlin_engine_dimensions: "{{ default_container_dimensions }}" +senlin_health_manager_dimensions: "{{ default_container_dimensions }}" senlin_api_default_volumes: - "{{ node_config_directory }}/senlin-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" +senlin_conductor_default_volumes: + - "{{ node_config_directory }}/senlin-conductor/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" senlin_engine_default_volumes: - "{{ node_config_directory }}/senlin-engine/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" +senlin_health_manager_default_volumes: + - "{{ node_config_directory }}/senlin-health-manager/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" senlin_extra_volumes: "{{ default_extra_volumes }}" senlin_api_extra_volumes: "{{ senlin_extra_volumes }}" +senlin_conductor_extra_volumes: "{{ senlin_extra_volumes }}" senlin_engine_extra_volumes: "{{ senlin_extra_volumes }}" +senlin_health_manager_extra_volumes: "{{ senlin_extra_volumes }}" #################### # OpenStack diff --git a/ansible/roles/senlin/handlers/main.yml b/ansible/roles/senlin/handlers/main.yml index d792e47ddc..51fbe4604e 100644 --- a/ansible/roles/senlin/handlers/main.yml +++ b/ansible/roles/senlin/handlers/main.yml @@ -14,6 +14,21 @@ when: - kolla_action != "config" +- name: Restart senlin-conductor container + vars: + service_name: "senlin-conductor" + service: "{{ senlin_services[service_name] }}" + become: true + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" + dimensions: "{{ service.dimensions }}" + when: + - kolla_action != "config" + - name: Restart senlin-engine container vars: service_name: "senlin-engine" @@ -28,3 +43,18 @@ dimensions: "{{ service.dimensions }}" when: - kolla_action != "config" + +- name: Restart senlin-health-manager container + vars: + service_name: "senlin-health-manager" + service: "{{ senlin_services[service_name] }}" + become: true + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" + dimensions: "{{ service.dimensions }}" + when: + - kolla_action != "config" diff --git a/ansible/roles/senlin/tasks/deploy.yml b/ansible/roles/senlin/tasks/deploy.yml index 33fa32cf6e..e7077189c0 100644 --- a/ansible/roles/senlin/tasks/deploy.yml +++ b/ansible/roles/senlin/tasks/deploy.yml @@ -4,7 +4,9 @@ - include_tasks: config.yml when: inventory_hostname in groups['senlin-api'] or - inventory_hostname in groups['senlin-engine'] + inventory_hostname in groups['senlin-conductor'] or + inventory_hostname in groups['senlin-engine'] or + inventory_hostname in groups['senlin-health-manager'] - include_tasks: clone.yml when: senlin_dev_mode | bool diff --git a/ansible/roles/senlin/templates/senlin-conductor.json.j2 b/ansible/roles/senlin/templates/senlin-conductor.json.j2 new file mode 100644 index 0000000000..1a612d8efc --- /dev/null +++ b/ansible/roles/senlin/templates/senlin-conductor.json.j2 @@ -0,0 +1,24 @@ +{ + "command": "senlin-conductor --config-file /etc/senlin/senlin.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/senlin.conf", + "dest": "/etc/senlin/senlin.conf", + "owner": "senlin", + "perm": "0600" + }{% if senlin_policy_file is defined %}, + { + "source": "{{ container_config_directory }}/{{ senlin_policy_file }}", + "dest": "/etc/senlin/{{ senlin_policy_file }}", + "owner": "senlin", + "perm": "0600" + }{% endif %} + ], + "permissions": [ + { + "path": "/var/log/kolla/senlin", + "owner": "senlin:senlin", + "recurse": true + } + ] +} diff --git a/ansible/roles/senlin/templates/senlin-health-manager.json.j2 b/ansible/roles/senlin/templates/senlin-health-manager.json.j2 new file mode 100644 index 0000000000..68196e1170 --- /dev/null +++ b/ansible/roles/senlin/templates/senlin-health-manager.json.j2 @@ -0,0 +1,24 @@ +{ + "command": "senlin-health-manager --config-file /etc/senlin/senlin.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/senlin.conf", + "dest": "/etc/senlin/senlin.conf", + "owner": "senlin", + "perm": "0600" + }{% if senlin_policy_file is defined %}, + { + "source": "{{ container_config_directory }}/{{ senlin_policy_file }}", + "dest": "/etc/senlin/{{ senlin_policy_file }}", + "owner": "senlin", + "perm": "0600" + }{% endif %} + ], + "permissions": [ + { + "path": "/var/log/kolla/senlin", + "owner": "senlin:senlin", + "recurse": true + } + ] +} diff --git a/ansible/roles/senlin/templates/senlin.conf.j2 b/ansible/roles/senlin/templates/senlin.conf.j2 index baa0a52eb9..fbe31a72ac 100644 --- a/ansible/roles/senlin/templates/senlin.conf.j2 +++ b/ansible/roles/senlin/templates/senlin.conf.j2 @@ -3,10 +3,6 @@ debug = {{ senlin_logging_debug }} log_dir = /var/log/kolla/senlin -{% if service_name == 'senlin-engine' %} -num_engine_workers = {{ openstack_service_workers }} -{% endif %} - transport_url = {{ rpc_transport_url }} {% if service_name == 'senlin-api' %} @@ -24,10 +20,25 @@ service_project_name = service service_user_domain = default service_project_domain = default +{% if service_name == 'senlin-conductor' %} +[conductor] +workers = {{ openstack_service_workers }} +{% endif %} + [database] connection = mysql+pymysql://{{ senlin_database_user }}:{{ senlin_database_password }}@{{ senlin_database_address }}/{{ senlin_database_name }} max_retries = -1 +{% if service_name == 'senlin-engine' %} +[engine] +workers = {{ openstack_service_workers }} +{% endif %} + +{% if service_name == 'senlin-health-manager' %} +[health_manager] +workers = {{ openstack_service_workers }} +{% endif %} + [keystone_authtoken] www_authenticate_uri = {{ keystone_internal_url }} auth_url = {{ keystone_admin_url }} diff --git a/ansible/site.yml b/ansible/site.yml index b292cdc4f9..045582bfbf 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -1128,7 +1128,9 @@ gather_facts: false hosts: - senlin-api + - senlin-conductor - senlin-engine + - senlin-health-manager - '&enable_senlin_True' serial: '{{ kolla_serial|default("0") }}' roles: diff --git a/releasenotes/notes/add-new-senlin-services-b53a9dc26453f947.yaml b/releasenotes/notes/add-new-senlin-services-b53a9dc26453f947.yaml new file mode 100644 index 0000000000..51d047ed7a --- /dev/null +++ b/releasenotes/notes/add-new-senlin-services-b53a9dc26453f947.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Add support for two new Senlin services; ``senlin-conductor`` and + ``senlin-health-manager``. Both of these services are required + for Senlin to be fully functional starting with the Ussuri release. diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index ad756a6b0d..f63db24abb 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -598,9 +598,15 @@ watcher [senlin-api:children] senlin +[senlin-conductor:children] +senlin + [senlin-engine:children] senlin +[senlin-health-manager:children] +senlin + # Searchlight [searchlight-api:children] searchlight