Replace mapdns with daemon DNS
Serve daemon-managed .vm names directly from bangerd on 127.0.0.1:42069 instead of shelling out to mapdns. This keeps DNS state tied to VM lifecycle and lets the daemon rebuild records from running VMs after startup or reconcile. Add a small in-process authoritative DNS server, register and remove records from the VM start/stop/delete paths, and show the listener in daemon status. Remove the mapdns config and preflight surface, stop helper-flow DNS publishing in customize.sh and interactive.sh, drop dns.sh from the runtime bundle, and update docs/tests for the new local-resolver integration model. Validated with GOCACHE=/tmp/banger-gocache go test ./..., GOCACHE=/tmp/banger-gocache make build, and bash -n customize.sh interactive.sh.
This commit is contained in:
parent
430f66d5dd
commit
0a0b0b617b
24 changed files with 576 additions and 278 deletions
|
|
@ -283,58 +283,36 @@ func writeDefaultImageArtifacts(t *testing.T, dir string) (rootfs, kernel, initr
|
|||
return rootfs, kernel, initrd, modulesDir, packages
|
||||
}
|
||||
|
||||
func TestSetDNSUsesConfiguredMapDNSDataFile(t *testing.T) {
|
||||
func TestStartVMDNSFailsWhenAddressBusy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dataFile := filepath.Join(t.TempDir(), "mapdns", "records.json")
|
||||
runner := &scriptedRunner{
|
||||
t: t,
|
||||
steps: []runnerStep{
|
||||
{
|
||||
call: runnerCall{
|
||||
name: "custom-mapdns",
|
||||
args: []string{"set", "--data-file", dataFile, "devbox.vm", "172.16.0.8"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
d := &Daemon{
|
||||
runner: runner,
|
||||
config: model.DaemonConfig{
|
||||
MapDNSBin: "custom-mapdns",
|
||||
MapDNSDataFile: dataFile,
|
||||
},
|
||||
packetConn, err := net.ListenPacket("udp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
t.Fatalf("ListenPacket: %v", err)
|
||||
}
|
||||
defer packetConn.Close()
|
||||
|
||||
if err := d.setDNS(context.Background(), "devbox", "172.16.0.8"); err != nil {
|
||||
t.Fatalf("setDNS: %v", err)
|
||||
d := &Daemon{}
|
||||
if err := d.startVMDNS(packetConn.LocalAddr().String()); err == nil {
|
||||
t.Fatal("startVMDNS() succeeded on occupied address, want failure")
|
||||
}
|
||||
runner.assertExhausted()
|
||||
}
|
||||
|
||||
func TestSetDNSUsesMapDNSDefaultsWhenDataFileUnset(t *testing.T) {
|
||||
func TestSetDNSPublishesIntoDaemonServer(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
runner := &scriptedRunner{
|
||||
t: t,
|
||||
steps: []runnerStep{
|
||||
{
|
||||
call: runnerCall{
|
||||
name: "mapdns",
|
||||
args: []string{"set", "devbox.vm", "172.16.0.8"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
d := &Daemon{
|
||||
runner: runner,
|
||||
config: model.DaemonConfig{},
|
||||
d := &Daemon{}
|
||||
if err := d.startVMDNS("127.0.0.1:0"); err != nil {
|
||||
t.Fatalf("startVMDNS: %v", err)
|
||||
}
|
||||
defer d.stopVMDNS()
|
||||
|
||||
if err := d.setDNS(context.Background(), "devbox", "172.16.0.8"); err != nil {
|
||||
t.Fatalf("setDNS: %v", err)
|
||||
}
|
||||
runner.assertExhausted()
|
||||
if _, ok := d.vmDNS.Lookup("devbox.vm"); !ok {
|
||||
t.Fatal("devbox.vm missing after setDNS")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchUsesPassedContext(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue