f-87: agent: bridge public = interfaces.internet, watchdog du segment #87

Le veth vp-<id>-e rejoint cfg.PublicBridge() (interfaces.internet, br-public
par défaut, jamais default_interface). Le watchdog signale un bridge public
absent, éteint ou sans port VXLAN. config.exemple.yml : internet: br-public.

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-25 23:36:14 +01:00
commit 26095062c8
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
10 changed files with 200 additions and 3 deletions

View file

@ -0,0 +1,39 @@
package watchdog
import (
"fmt"
configuration "git.g3e.fr/syonad/two/internal/config/agent"
"git.g3e.fr/syonad/two/internal/netif"
"git.g3e.fr/syonad/two/internal/watchdog/notify"
)
const kindPublic = "public"
type publicProbe interface {
LinkProblem(name string) string
VxlanPorts(bridge string) ([]string, error)
}
type systemPublicProbe struct{}
func (systemPublicProbe) LinkProblem(name string) string { return linkProblem(name) }
func (systemPublicProbe) VxlanPorts(bridge string) ([]string, error) {
return netif.BridgeVxlanPorts(bridge)
}
func CheckPublicSegment(cfg *configuration.Config, p publicProbe, n notify.Notifier) {
bridge := cfg.PublicBridge()
if problem := p.LinkProblem(bridge); problem != "" {
n.Notify(kindPublic, bridge, problem+" (public bridge, interfaces.internet): the vpcs of this host have no public segment")
return
}
ports, err := p.VxlanPorts(bridge)
switch {
case err != nil:
n.Notify(kindPublic, bridge, fmt.Sprintf("vxlan ports unreadable: %v", err))
case len(ports) == 0:
n.Notify(kindPublic, bridge, "no vxlan port: the public segment is unreachable from this host")
}
}