From f851ca27e42dcd1bc32cf48231837b7f92d2775b Mon Sep 17 00:00:00 2001 From: Santhi Prakash <38608178+santhiprakash@users.noreply.github.com> Date: Wed, 4 Nov 2026 15:51:20 +0530 Subject: [PATCH] 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 --- cmd/containerboot/main.go | 2 +- cmd/containerboot/main_test.go | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/cmd/containerboot/main.go b/cmd/containerboot/main.go index 5d249cc00..06505ab58 100644 --- a/cmd/containerboot/main.go +++ b/cmd/containerboot/main.go @@ -879,7 +879,7 @@ runLoop: egressAddrs, err := resolveTailnetFQDN(nmState, cfg.TailnetTargetFQDN) if err != nil { log.Print(err.Error()) - break + continue } newCurentEgressIPs := deephash.Hash(&egressAddrs) diff --git a/cmd/containerboot/main_test.go b/cmd/containerboot/main_test.go index 8c4a079d0..70105aafa 100644 --- a/cmd/containerboot/main_test.go +++ b/cmd/containerboot/main_test.go @@ -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{