left4me: split derived_from_domain into one reactor per consumer

Each reactor now scopes to a single downstream bundle:
  nginx_vhosts    -> nginx/vhosts
  nftables_input  -> nftables/input

Easier to grep "what writes nginx/vhosts" and harder to accidentally
couple unrelated keys together. Same merged metadata.
This commit is contained in:
CroneKorkN 2026-05-10 18:33:11 +02:00
parent fc66267656
commit 7d3554f8a5
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

View file

@ -71,18 +71,12 @@ defaults = {
@metadata_reactor.provides( @metadata_reactor.provides(
'nginx/vhosts', 'nginx/vhosts',
'nftables/input',
) )
def derived_from_domain(metadata): def nginx_vhosts(metadata):
# letsencrypt/domains is auto-populated from nginx/vhosts.keys() by # letsencrypt/domains and monitoring/services for the vhost are auto-
# bundles/nginx/metadata.py. monitoring/services for the vhost is also # populated by bundles/nginx/metadata.py. We just declare check_path:
# auto-populated there using the vhost's check_path/check_protocol — # '/health' so the auto-check hits the Flask health endpoint, not '/'.
# we just declare check_path: '/health' below to point the auto-check
# at the Flask health endpoint instead of '/'.
domain = metadata.get('left4me/domain') domain = metadata.get('left4me/domain')
port_start = metadata.get('left4me/port_range_start')
port_end = metadata.get('left4me/port_range_end')
return { return {
'nginx': { 'nginx': {
'vhosts': { 'vhosts': {
@ -95,6 +89,16 @@ def derived_from_domain(metadata):
}, },
}, },
}, },
}
@metadata_reactor.provides(
'nftables/input',
)
def nftables_input(metadata):
port_start = metadata.get('left4me/port_range_start')
port_end = metadata.get('left4me/port_range_end')
return {
'nftables': { 'nftables': {
'input': { 'input': {
f'udp dport {port_start}-{port_end} accept', f'udp dport {port_start}-{port_end} accept',