-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for extra OVN cluster per node for ovn-bgp-agent
- Loading branch information
Showing
22 changed files
with
515 additions
and
5 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
roles/edpm_network_config/templates/single_nic_vlans/single_nic_vlans_bgp_ovn.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
{% set mtu_list = [ctlplane_mtu] %} | ||
{% for network in role_networks %} | ||
{{ mtu_list.append(lookup('vars', networks_lower[network] ~ '_mtu')) }} | ||
{%- endfor %} | ||
{% set min_viable_mtu = mtu_list | max %} | ||
network_config: | ||
- type: interface | ||
name: nic1 | ||
mtu: {{ ctlplane_mtu }} | ||
dns_servers: {{ ctlplane_dns_nameservers }} | ||
domain: {{ dns_search_domains }} | ||
use_dhcp: false | ||
addresses: | ||
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }} | ||
{% for network in role_networks %} | ||
- type: vlan | ||
device: nic1 | ||
mtu: {{ lookup('vars', networks_lower[network] ~ '_mtu') }} | ||
vlan_id: {{ lookup('vars', networks_lower[network] ~ '_vlan_id') }} | ||
addresses: | ||
- ip_netmask: | ||
{{ lookup('vars', networks_lower[network] ~ '_ip') }}/{{ lookup('vars', networks_lower[network] ~ '_cidr') }} | ||
routes: {{ lookup('vars', networks_lower[network] ~ '_host_routes') }} | ||
{% endfor %} | ||
- type: ovs_bridge | ||
name: br-provider | ||
use_dhcp: false | ||
- type: ovs_bridge | ||
name: {{ neutron_physical_bridge_name }} | ||
mtu: {{ min_viable_mtu }} | ||
use_dhcp: false | ||
addresses: | ||
- ip_netmask: {{ lookup('vars', 'bgp_net1_ip') }}/30 | ||
members: | ||
- type: interface | ||
name: nic2 | ||
mtu: {{ min_viable_mtu }} | ||
# force the MAC address of the bridge to this interface | ||
primary: true | ||
- type: ovs_bridge | ||
name: {{ neutron_physical_bridge_name }}-2 | ||
mtu: {{ min_viable_mtu }} | ||
use_dhcp: false | ||
addresses: | ||
- ip_netmask: {{ lookup('vars', 'bgp_net2_ip') }}/30 | ||
members: | ||
- type: interface | ||
name: nic3 | ||
mtu: {{ min_viable_mtu }} | ||
# force the MAC address of the bridge to this interface | ||
primary: true | ||
- type: interface | ||
name: lo | ||
addresses: | ||
- ip_netmask: {{ lookup('vars', 'bgp_main_net_ip') }}/32 | ||
- ip_netmask: {{ lookup('vars', 'bgp_main_net6_ip') }}/128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# Cleanup ovn-bgp-agent OVS bridges. To be called on startup to avoid | ||
# "difficult-to-debug" issues with partially configured resources. | ||
|
||
$BGP_BRIDGE=${INT_BRIDGE:-"br-bgp"} | ||
|
||
for port in `ovs-vsctl list-ports ${BGP_BRIDGE}`; do | ||
skip_cleanup=`ovs-vsctl --if-exists get Interface $port external_ids:skip_cleanup` | ||
if ! [[ "x$skip_cleanup" == "x\"true\"" ]]; then | ||
ovs-vsctl del-port ${BGP_BRIDGE} $port | ||
fi | ||
done |
12 changes: 12 additions & 0 deletions
12
roles/edpm_ovn_bgp_agent/files/ovn-bgp-agent-cleanup.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=OVN BGP Agent cleanup on startup | ||
After=openvswitch.service network.target | ||
Before=edpm_ovn_bgp_agent.service | ||
RefuseManualStop=yes | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/libexec/ovn-bgp-agent-cleanup | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# Copyright 2023 Red Hat, Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
- name: Ensure the Openvswitch package is installed | ||
ansible.builtin.package: | ||
name: openvswitch | ||
state: present | ||
|
||
- name: Ensure the OVS service is running | ||
ansible.builtin.systemd: | ||
name: openvswitch | ||
state: started | ||
|
||
- name: Configure OVS external_ids | ||
ansible.builtin.shell: > | ||
ovs-vsctl set open . {% for key, value in edpm_ovn_bgp_agent_local_ovn_ovs_external_ids.items() -%} external_ids:{{ key }}={{ value }} {% endfor %} | ||
register: ovn_ovs_external_ids | ||
changed_when: ovn_ovs_external_ids.rc == 0 | ||
failed_when: ovn_ovs_external_ids.rc != 0 | ||
when: edpm_ovn_bgp_agent_local_ovn_ovs_external_ids | length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
# Copyright 2023 Red Hat, Inc. | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
- name: Create persistent directories for in-node ovn cluster | ||
ansible.builtin.file: | ||
path: "{{ item.path }}" | ||
state: directory | ||
setype: "{{ item.setype }}" | ||
mode: "{{ item.mode | default(omit) }}" | ||
loop: | ||
- {'path': /var/log/containers/openvswitch, 'setype': container_file_t, 'mode': '0750'} | ||
- {'path': /var/lib/openvswitch/ovn, 'setype': container_file_t} | ||
|
||
- name: Enable virt_sandbox_use_netlink for healthcheck | ||
ansible.posix.seboolean: | ||
name: virt_sandbox_use_netlink | ||
persistent: true | ||
state: true | ||
when: | ||
- ansible_facts.selinux is defined | ||
- ansible_facts.selinux.status == "enabled" | ||
|
||
- name: Copy in cleanup script | ||
ansible.builtin.copy: | ||
src: ovn-bgp-agent-cleanup | ||
dest: '/usr/libexec/ovn-bgp-agent-cleanup' | ||
force: true | ||
mode: '0755' | ||
|
||
- name: Copy in cleanup service | ||
ansible.builtin.copy: | ||
src: ovn-bgp-agent-cleanup.service | ||
dest: '/usr/lib/systemd/system/ovn-bgp-agent-cleanup.service' | ||
force: true | ||
mode: '0644' | ||
|
||
- name: Enabling the cleanup service | ||
ansible.builtin.service: | ||
name: ovn-bgp-agent-cleanup | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.