f-90: vm, vpc, watchdog: redirections en nft, retrait d'iptables #90

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-31 14:15:07 +01:00
commit 682696214a
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
10 changed files with 31 additions and 173 deletions

View file

@ -7,9 +7,9 @@ import (
hostsvcapi "git.g3e.fr/syonad/two/internal/api/hostsvc"
hostsvcclient "git.g3e.fr/syonad/two/internal/client/hostsvc"
"git.g3e.fr/syonad/two/internal/hostsvc"
"git.g3e.fr/syonad/two/internal/iptables"
"git.g3e.fr/syonad/two/internal/netif"
"git.g3e.fr/syonad/two/internal/netns"
"git.g3e.fr/syonad/two/internal/nft"
"git.g3e.fr/syonad/two/internal/state"
"git.g3e.fr/syonad/two/internal/vpc"
"git.g3e.fr/syonad/two/internal/watchdog/notify"
@ -58,7 +58,7 @@ func (systemHostSvcProbe) Redirect(name string) (bool, error) {
var ok bool
err := netns.Call(name, func() error {
var err error
ok, err = iptables.HasHostSvcRedirect(hostsvc.ServiceIP)
ok, err = nft.HasHostSvcRedirect(hostsvc.ServiceIP)
return err
})
return ok, err
@ -103,7 +103,7 @@ func CheckHostSvc(db *badger.DB, p hostSvcProbe, n notify.Notifier) error {
if ok, err := p.Redirect(name); err != nil {
n.Notify(kindVPC, name, fmt.Sprintf("dns and ntp redirection unreadable: %v", err))
} else if !ok {
n.Notify(kindVPC, name, fmt.Sprintf("dns and ntp redirection to %s missing or incomplete (chain %s)", hostsvc.ServiceIP, iptables.HostSvcChain))
n.Notify(kindVPC, name, fmt.Sprintf("dns and ntp redirection to %s missing or incomplete (nft chain ip %s %s)", hostsvc.ServiceIP, nft.Table, nft.HostSvcChain))
}
}
return nil

View file

@ -97,7 +97,7 @@ func TestCheckHostSvc_ReportsEachMissingPiece(t *testing.T) {
for name, want := range map[string]string{
"vp-unserved": "not served by two-hostsvc: its vms get no dns nor ntp",
"vp-noaddr": "169.254.169.253 missing on hostsvc (in netns)",
"vp-noredirect": "dns and ntp redirection to 169.254.169.253 missing or incomplete (chain TWO-HOSTSVC)",
"vp-noredirect": "dns and ntp redirection to 169.254.169.253 missing or incomplete (nft chain ip two hostsvc)",
} {
got := r.forName(name)
if len(got) != 1 || got[0].kind != "vpc" || got[0].problem != want {