Start managing bird2

Also give dummy-interface support to sunet-l4lb-namespace tool, used
to hold IPv4/IPv6 service addresses that should be announced via BGP.
This commit is contained in:
Patrik Lundin 2024-10-25 15:19:21 +02:00
parent d632aaca5c
commit e2d550bf29
Signed by: patlu
GPG key ID: A0A812BA2249F294
3 changed files with 30 additions and 1 deletions

View file

@ -47,6 +47,11 @@ def configure_interfaces(
False, False,
) )
if not if_exists: if not if_exists:
if if_name.startswith("dummy"):
run_command(
f"ip netns exec {namespace} ip link add {if_name} type dummy"
)
else:
run_command(f"ip link set {if_name} netns {namespace}") run_command(f"ip link set {if_name} netns {namespace}")
proc = run_command(f"ip netns exec {namespace} ip -j addr show dev {if_name}") proc = run_command(f"ip netns exec {namespace} ip -j addr show dev {if_name}")

View file

@ -15,6 +15,10 @@ class cdn::l4lb(
} }
} }
include sunet::systemd_reload
package {'bird2': ensure => installed }
file { '/opt/sunet-cdn': file { '/opt/sunet-cdn':
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
@ -59,4 +63,20 @@ class cdn::l4lb(
mode => '0644', mode => '0644',
content => template('cdn/l4lb/sunet-l4lb-namespace.service.erb'), content => template('cdn/l4lb/sunet-l4lb-namespace.service.erb'),
} }
file { '/etc/systemd/system/bird.service.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
file { '/etc/systemd/system/bird.service.d/override.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => template('cdn/l4lb/bird-override.conf.erb'),
notify => [Class['sunet::systemd_reload']]
}
} }

View file

@ -0,0 +1,4 @@
[Service]
NetworkNamespacePath=/var/run/netns/l4lb
Wants=sunet-l4lb-namespace.service
After=sunet-l4lb-namespace.service