ovn: Break out role into ovn-db and ovn-controller roles
Instead of handling everything in one role - let's have small fit-for-purpose roles, because in reality these are two hosts roles and performance should be better with this approach. [1]: https://docs.ovn.org/en/latest/intro/install/ovn-upgrades.html Change-Id: I8f9dbe9d950323f16375ad5e1dbaedfb1be6585f
This commit is contained in:
parent
68376d6f31
commit
63a7968d8d
38
ansible/roles/ovn-controller/defaults/main.yml
Normal file
38
ansible/roles/ovn-controller/defaults/main.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
ovn_controller_services:
|
||||||
|
ovn-controller:
|
||||||
|
container_name: ovn_controller
|
||||||
|
group: ovn-controller
|
||||||
|
enabled: true
|
||||||
|
image: "{{ ovn_controller_image_full }}"
|
||||||
|
volumes: "{{ ovn_controller_default_volumes + ovn_controller_extra_volumes }}"
|
||||||
|
dimensions: "{{ ovn_controller_dimensions }}"
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Docker
|
||||||
|
####################
|
||||||
|
ovn_tag: "{{ openstack_tag }}"
|
||||||
|
|
||||||
|
ovn_controller_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-controller"
|
||||||
|
ovn_controller_tag: "{{ ovn_tag }}"
|
||||||
|
ovn_controller_image_full: "{{ ovn_controller_image }}:{{ ovn_controller_tag }}"
|
||||||
|
|
||||||
|
ovn_controller_dimensions: "{{ default_container_dimensions }}"
|
||||||
|
|
||||||
|
ovn_controller_default_volumes:
|
||||||
|
- "{{ node_config_directory }}/ovn-controller/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/run/openvswitch:/run/openvswitch:shared"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
|
||||||
|
ovn_controller_extra_volumes: "{{ default_extra_volumes }}"
|
||||||
|
|
||||||
|
#####
|
||||||
|
# OVN
|
||||||
|
#####
|
||||||
|
# Base MAC for ovn-chassis-mac-mappings generation
|
||||||
|
ovn_base_mac: "52:54:00"
|
||||||
|
# Configure OVN remote probe interval time in ms
|
||||||
|
ovn_remote_probe_interval: "60000"
|
||||||
|
# Configure OVN openflow interval in s
|
||||||
|
ovn_openflow_probe_interval: "60"
|
15
ansible/roles/ovn-controller/handlers/main.yml
Normal file
15
ansible/roles/ovn-controller/handlers/main.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- name: Restart ovn-controller container
|
||||||
|
vars:
|
||||||
|
service_name: "ovn-controller"
|
||||||
|
service: "{{ ovn_controller_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"
|
16
ansible/roles/ovn-controller/tasks/check-containers.yml
Normal file
16
ansible/roles/ovn-controller/tasks/check-containers.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: Check ovn-controller containers
|
||||||
|
become: true
|
||||||
|
kolla_docker:
|
||||||
|
action: "compare_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ item.value.container_name }}"
|
||||||
|
image: "{{ item.value.image }}"
|
||||||
|
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
|
||||||
|
dimensions: "{{ item.value.dimensions }}"
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- item.value.enabled | bool
|
||||||
|
with_dict: "{{ ovn_controller_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart {{ item.key }} container
|
26
ansible/roles/ovn-controller/tasks/config.yml
Normal file
26
ansible/roles/ovn-controller/tasks/config.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- name: Ensuring config directories exist
|
||||||
|
file:
|
||||||
|
path: "{{ node_config_directory }}/{{ item.key }}"
|
||||||
|
state: "directory"
|
||||||
|
owner: "{{ config_owner_user }}"
|
||||||
|
group: "{{ config_owner_group }}"
|
||||||
|
mode: "0770"
|
||||||
|
become: true
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- item.value.enabled | bool
|
||||||
|
with_dict: "{{ ovn_controller_services }}"
|
||||||
|
|
||||||
|
- name: Copying over config.json files for services
|
||||||
|
template:
|
||||||
|
src: "{{ item.key }}.json.j2"
|
||||||
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
||||||
|
mode: "0660"
|
||||||
|
become: true
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- item.value.enabled | bool
|
||||||
|
with_dict: "{{ ovn_controller_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart {{ item.key }} container
|
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
- import_tasks: check-containers.yml
|
- import_tasks: check-containers.yml
|
||||||
|
|
||||||
- import_tasks: bootstrap.yml
|
- import_tasks: setup-ovs.yml
|
||||||
when: inventory_hostname in groups['ovn-controller']
|
|
||||||
|
|
||||||
- name: Flush handlers
|
- name: Flush handlers
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
6
ansible/roles/ovn-controller/tasks/stop.yml
Normal file
6
ansible/roles/ovn-controller/tasks/stop.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- import_role:
|
||||||
|
role: service-stop
|
||||||
|
vars:
|
||||||
|
project_services: "{{ ovn_controller_services }}"
|
||||||
|
service_name: "{{ project_name }}"
|
2
ansible/roles/ovn-controller/tasks/upgrade.yml
Normal file
2
ansible/roles/ovn-controller/tasks/upgrade.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: deploy.yml
|
6
ansible/roles/ovn-controller/vars/main.yml
Normal file
6
ansible/roles/ovn-controller/vars/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
project_name: "ovn"
|
||||||
|
|
||||||
|
# NOTE(mnasiadka): we need this for the ovn-controller role
|
||||||
|
# because this role's vars prefix does not match "{{ project_name }}"
|
||||||
|
kolla_role_name: "ovn_controller"
|
@ -1,12 +1,5 @@
|
|||||||
---
|
---
|
||||||
ovn_services:
|
ovn_db_services:
|
||||||
ovn-controller:
|
|
||||||
container_name: ovn_controller
|
|
||||||
group: ovn-controller
|
|
||||||
enabled: true
|
|
||||||
image: "{{ ovn_controller_image_full }}"
|
|
||||||
volumes: "{{ ovn_controller_default_volumes + ovn_controller_extra_volumes }}"
|
|
||||||
dimensions: "{{ ovn_controller_dimensions }}"
|
|
||||||
ovn-northd:
|
ovn-northd:
|
||||||
container_name: ovn_northd
|
container_name: ovn_northd
|
||||||
group: ovn-northd
|
group: ovn-northd
|
||||||
@ -35,10 +28,6 @@ ovn_services:
|
|||||||
####################
|
####################
|
||||||
ovn_tag: "{{ openstack_tag }}"
|
ovn_tag: "{{ openstack_tag }}"
|
||||||
|
|
||||||
ovn_controller_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-controller"
|
|
||||||
ovn_controller_tag: "{{ ovn_tag }}"
|
|
||||||
ovn_controller_image_full: "{{ ovn_controller_image }}:{{ ovn_controller_tag }}"
|
|
||||||
|
|
||||||
ovn_northd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-northd"
|
ovn_northd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/ovn-northd"
|
||||||
ovn_northd_tag: "{{ ovn_tag }}"
|
ovn_northd_tag: "{{ ovn_tag }}"
|
||||||
ovn_northd_image_full: "{{ ovn_northd_image }}:{{ ovn_northd_tag }}"
|
ovn_northd_image_full: "{{ ovn_northd_image }}:{{ ovn_northd_tag }}"
|
||||||
@ -51,16 +40,10 @@ ovn_sb_db_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docke
|
|||||||
ovn_sb_db_tag: "{{ ovn_tag }}"
|
ovn_sb_db_tag: "{{ ovn_tag }}"
|
||||||
ovn_sb_db_image_full: "{{ ovn_sb_db_image }}:{{ ovn_sb_db_tag }}"
|
ovn_sb_db_image_full: "{{ ovn_sb_db_image }}:{{ ovn_sb_db_tag }}"
|
||||||
|
|
||||||
ovn_controller_dimensions: "{{ default_container_dimensions }}"
|
|
||||||
ovn_northd_dimensions: "{{ default_container_dimensions }}"
|
ovn_northd_dimensions: "{{ default_container_dimensions }}"
|
||||||
ovn_nb_db_dimensions: "{{ default_container_dimensions }}"
|
ovn_nb_db_dimensions: "{{ default_container_dimensions }}"
|
||||||
ovn_sb_db_dimensions: "{{ default_container_dimensions }}"
|
ovn_sb_db_dimensions: "{{ default_container_dimensions }}"
|
||||||
|
|
||||||
ovn_controller_default_volumes:
|
|
||||||
- "{{ node_config_directory }}/ovn-controller/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/run/openvswitch:/run/openvswitch:shared"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
ovn_northd_default_volumes:
|
ovn_northd_default_volumes:
|
||||||
- "{{ node_config_directory }}/ovn-northd/:{{ container_config_directory }}/:ro"
|
- "{{ node_config_directory }}/ovn-northd/:{{ container_config_directory }}/:ro"
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
@ -76,18 +59,7 @@ ovn_sb_db_default_volumes:
|
|||||||
- "ovn_sb_db:/var/lib/openvswitch/ovn-sb/"
|
- "ovn_sb_db:/var/lib/openvswitch/ovn-sb/"
|
||||||
- "kolla_logs:/var/log/kolla/"
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
|
||||||
ovn_extra_volumes: "{{ default_extra_volumes }}"
|
ovn_db_extra_volumes: "{{ default_extra_volumes }}"
|
||||||
ovn_controller_extra_volumes: "{{ ovn_extra_volumes }}"
|
ovn_northd_extra_volumes: "{{ ovn_db_extra_volumes }}"
|
||||||
ovn_northd_extra_volumes: "{{ ovn_extra_volumes }}"
|
ovn_nb_db_extra_volumes: "{{ ovn_db_extra_volumes }}"
|
||||||
ovn_nb_db_extra_volumes: "{{ ovn_extra_volumes }}"
|
ovn_sb_db_extra_volumes: "{{ ovn_db_extra_volumes }}"
|
||||||
ovn_sb_db_extra_volumes: "{{ ovn_extra_volumes }}"
|
|
||||||
|
|
||||||
#####
|
|
||||||
# OVN
|
|
||||||
#####
|
|
||||||
# Base MAC for ovn-chassis-mac-mappings generation
|
|
||||||
ovn_base_mac: "52:54:00"
|
|
||||||
# Configure OVN remote probe interval time in ms
|
|
||||||
ovn_remote_probe_interval: "60000"
|
|
||||||
# Configure OVN openflow interval in s
|
|
||||||
ovn_openflow_probe_interval: "60"
|
|
@ -2,7 +2,7 @@
|
|||||||
- name: Restart ovn-nb-db container
|
- name: Restart ovn-nb-db container
|
||||||
vars:
|
vars:
|
||||||
service_name: "ovn-nb-db"
|
service_name: "ovn-nb-db"
|
||||||
service: "{{ ovn_services[service_name] }}"
|
service: "{{ ovn_db_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
- name: Restart ovn-sb-db container
|
- name: Restart ovn-sb-db container
|
||||||
vars:
|
vars:
|
||||||
service_name: "ovn-sb-db"
|
service_name: "ovn-sb-db"
|
||||||
service: "{{ ovn_services[service_name] }}"
|
service: "{{ ovn_db_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
||||||
@ -60,22 +60,7 @@
|
|||||||
- name: Restart ovn-northd container
|
- name: Restart ovn-northd container
|
||||||
vars:
|
vars:
|
||||||
service_name: "ovn-northd"
|
service_name: "ovn-northd"
|
||||||
service: "{{ ovn_services[service_name] }}"
|
service: "{{ ovn_db_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 ovn-controller container
|
|
||||||
vars:
|
|
||||||
service_name: "ovn-controller"
|
|
||||||
service: "{{ ovn_services[service_name] }}"
|
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
@ -11,6 +11,6 @@
|
|||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ ovn_services }}"
|
with_dict: "{{ ovn_db_services }}"
|
||||||
notify:
|
notify:
|
||||||
- Restart {{ item.key }} container
|
- Restart {{ item.key }} container
|
@ -10,7 +10,7 @@
|
|||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ ovn_services }}"
|
with_dict: "{{ ovn_db_services }}"
|
||||||
|
|
||||||
- name: Copying over config.json files for services
|
- name: Copying over config.json files for services
|
||||||
template:
|
template:
|
||||||
@ -21,6 +21,6 @@
|
|||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ ovn_services }}"
|
with_dict: "{{ ovn_db_services }}"
|
||||||
notify:
|
notify:
|
||||||
- Restart {{ item.key }} container
|
- Restart {{ item.key }} container
|
2
ansible/roles/ovn-db/tasks/deploy-containers.yml
Normal file
2
ansible/roles/ovn-db/tasks/deploy-containers.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: check-containers.yml
|
2
ansible/roles/ovn-db/tasks/main.yml
Normal file
2
ansible/roles/ovn-db/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include_tasks: "{{ kolla_action }}.yml"
|
3
ansible/roles/ovn-db/tasks/pull.yml
Normal file
3
ansible/roles/ovn-db/tasks/pull.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- import_role:
|
||||||
|
role: service-images-pull
|
2
ansible/roles/ovn-db/tasks/reconfigure.yml
Normal file
2
ansible/roles/ovn-db/tasks/reconfigure.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: deploy.yml
|
@ -2,5 +2,5 @@
|
|||||||
- import_role:
|
- import_role:
|
||||||
role: service-stop
|
role: service-stop
|
||||||
vars:
|
vars:
|
||||||
project_services: "{{ ovn_services }}"
|
project_services: "{{ ovn_db_services }}"
|
||||||
service_name: "{{ project_name }}"
|
service_name: "{{ project_name }}"
|
2
ansible/roles/ovn-db/tasks/upgrade.yml
Normal file
2
ansible/roles/ovn-db/tasks/upgrade.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: deploy.yml
|
6
ansible/roles/ovn-db/vars/main.yml
Normal file
6
ansible/roles/ovn-db/vars/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
project_name: "ovn"
|
||||||
|
|
||||||
|
# NOTE(mnasiadka): we need this for the ovn-db role because this role's
|
||||||
|
# vars prefix does not match "{{ project_name }}"
|
||||||
|
kolla_role_name: "ovn_db"
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
project_name: "ovn"
|
|
@ -651,18 +651,27 @@
|
|||||||
tags: ovs-dpdk,
|
tags: ovs-dpdk,
|
||||||
when: "(enable_openvswitch | bool) and (enable_ovs_dpdk | bool)"}
|
when: "(enable_openvswitch | bool) and (enable_ovs_dpdk | bool)"}
|
||||||
|
|
||||||
- name: Apply role ovn
|
- name: Apply role ovn-db
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
hosts:
|
hosts:
|
||||||
- ovn-controller
|
|
||||||
- ovn-nb-db
|
- ovn-nb-db
|
||||||
- ovn-northd
|
- ovn-northd
|
||||||
- ovn-sb-db
|
- ovn-sb-db
|
||||||
- '&enable_ovn_True'
|
- '&enable_ovn_True'
|
||||||
serial: '{{ kolla_serial|default("0") }}'
|
serial: '{{ kolla_serial|default("0") }}'
|
||||||
roles:
|
roles:
|
||||||
- { role: ovn,
|
- { role: ovn-db,
|
||||||
tags: ovn }
|
tags: [ovn, ovn-db] }
|
||||||
|
|
||||||
|
- name: Apply role ovn-controller
|
||||||
|
gather_facts: false
|
||||||
|
hosts:
|
||||||
|
- ovn-controller
|
||||||
|
- '&enable_ovn_True'
|
||||||
|
serial: '{{ kolla_serial|default("0") }}'
|
||||||
|
roles:
|
||||||
|
- { role: ovn-controller,
|
||||||
|
tags: [ovn, ovn-controller] }
|
||||||
|
|
||||||
- name: Apply role neutron
|
- name: Apply role neutron
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
7
releasenotes/notes/ovn-controller-ecb49695dc377e88.yaml
Normal file
7
releasenotes/notes/ovn-controller-ecb49695dc377e88.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
``ovn`` role has been split into ``ovn-controller`` and ``ovn-db``
|
||||||
|
roles, therefore users that have ``ovn_extra_volumes`` configured
|
||||||
|
need to adapt their config to use ``ovn_db_extra_volumes`` or
|
||||||
|
``ovn_controller_extra_volumes``.
|
@ -196,7 +196,7 @@
|
|||||||
parent: kolla-ansible-base
|
parent: kolla-ansible-base
|
||||||
voting: false
|
voting: false
|
||||||
files:
|
files:
|
||||||
- ^ansible/roles/(neutron|octavia|openvswitch|ovn)/
|
- ^ansible/roles/(neutron|octavia|openvswitch|ovn-controller|ovn-db)/
|
||||||
- ^tests/test-ovn.sh
|
- ^tests/test-ovn.sh
|
||||||
- ^tests/test-core-openstack.sh
|
- ^tests/test-core-openstack.sh
|
||||||
vars:
|
vars:
|
||||||
|
Loading…
Reference in New Issue
Block a user