cmd/containerboot: keep egress proxy watch alive after failed FQDN resolve (#22108)

In singleton egress mode (TS_TAILNET_TARGET_FQDN), a failed resolution
of the target FQDN logged the error but then broke out of the main
runLoop instead of continuing to the next netmap update. From then on
containerboot blocked in wg.Wait() while the pod still looked healthy,
and the egress proxy kept forwarding to stale addresses until restart.

A missing target is typically transient (peer not yet in the netmap,
ACL change in flight), so log and continue to let the next netmap
update retry the resolution and reinstall the forwarding rules.

Fixes #22102

Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
This commit is contained in:
Santhi Prakash authored and GitHub committed 2026-11-04 10:21:20 +00:00
1 parent 4290c03d37
commit f851ca27e4
2 files changed
+45 -1

No files matched your search

+1 -1
View File
@@ -879,7 +879,7 @@ runLoop:
egressAddrs, err := resolveTailnetFQDN(nmState, cfg.TailnetTargetFQDN)
if err != nil {
log.Print(err.Error())
break
continue
}
newCurentEgressIPs := deephash.Hash(&egressAddrs)
+44
View File
@@ -407,6 +407,50 @@ func TestContainerBoot(t *testing.T) {
},
}
},
"egress_fqdn_transient_resolve_failure": func(env *testEnv) testCase {
return testCase{
Env: map[string]string{
"TS_AUTHKEY": "tskey-key",
"TS_TAILNET_TARGET_FQDN": "target-node.test.ts.net.",
"TS_USERSPACE": "false",
},
Phases: []phase{
{
WantCmds: []string{
"/usr/bin/tailscaled --socket=/tmp/tailscaled.sock --state=mem: --statedir=/tmp",
"/usr/bin/tailscale --socket=/tmp/tailscaled.sock up --accept-dns=false --authkey=tskey-key",
},
WantFiles: map[string]string{
"proc/sys/net/ipv4/ip_forward": "1",
"proc/sys/net/ipv6/conf/all/forwarding": "0",
},
},
{
// The target peer is not in the netmap yet, so
// resolving the FQDN fails. containerboot must keep
// processing subsequent netmap updates rather than
// exiting its watch loop (issue #22102).
Notify: runningNotify,
WantLog: `could not find Tailscale node, service or 4via6 address "target-node.test.ts.net."; it either does not exist, or not reachable because of ACLs`,
},
{
// Once the peer appears, the next netmap update must
// resolve the FQDN and install forwarding rules.
Notify: &ipn.Notify{
State: new(ipn.Running),
PeersChanged: []*tailcfg.Node{
{
StableID: tailcfg.StableNodeID("targetID"),
Name: "target-node.test.ts.net.",
Addresses: []netip.Prefix{netip.MustParsePrefix("100.99.99.99/32")},
},
},
},
WantLog: "Installing forwarding rules for destination 100.99.99.99",
},
},
}
},
"authkey_once": func(env *testEnv) testCase {
return testCase{
Env: map[string]string{