Kubernetes manifests for a public node, and --announce

k8s/base (kustomize): StatefulSet with a volume, p2p LoadBalancer for 4001
TCP+UDP, ClusterIP for the UI, optional ingress; k8s/overlays/nodeport for
clusters without a load balancer. The pod waits for 'allmende init' so the
recovery phrase never goes to a log.

--announce makes a node that sits behind a router or in a container announce
the address others can dial (e.g. /dns4/name/tcp/4001), so a bootstrap node
behind a port forward works, and the DNS records it prints name the host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 11:40:25 +01:00
co-authored by Claude Sonnet 5.5
parent dd229895f4
commit 819df6d512
15 changed files with 431 additions and 1 deletions
+12
View File
@@ -27,3 +27,15 @@ func TestBootstrapRecordsKeepOnlyPublicAddresses(t *testing.T) {
t.Fatalf("got %v\nwant %v", got, want)
}
}
func TestAHostnameAddressIsPublishedAsItIs(t *testing.T) {
const id = "12D3KooWQYhTNQdmr3ArTeUHRYzFg94BKyTkoWBDWez9kSCVe2Xo"
got := bootstrapRecords([]string{
"/dns4/node.example.org/tcp/4001/p2p/" + id,
"/dns4/localhost/tcp/4001/p2p/" + id,
})
want := []string{"dnsaddr=/dns4/node.example.org/tcp/4001/p2p/" + id}
if !reflect.DeepEqual(got, want) {
t.Fatalf("got %v\nwant %v", got, want)
}
}
+4
View File
@@ -44,6 +44,9 @@ func cmdRun(args []string) error {
noDHT := fs.Bool("no-dht", false, "do not look for peers through the DHT")
public := fs.Bool("public", false,
"this node is reachable from the internet: serve the DHT and relay for nodes behind a NAT (for bootstrap nodes)")
var announceAddrs listFlag
fs.Var(&announceAddrs, "announce",
"address others should dial, when this node sits behind a router or in a container, e.g. /dns4/node.example.org/tcp/4001; repeatable")
fs.Var(&listen, "listen", "libp2p listen multiaddr; repeatable (default: all interfaces, random ports)")
httpAddr := fs.String("http", "127.0.0.1:8080", "address for the HTTP API")
noMDNS := fs.Bool("no-mdns", false, "do not look for peers on the local network")
@@ -121,6 +124,7 @@ func cmdRun(args []string) error {
MDNS: !*noMDNS,
DHT: !*noDHT,
Public: *public,
Announce: announceAddrs,
PeerCache: filepath.Join(*data, peersFile),
Difficulty: *difficulty,
Logger: log,