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:
Thales Maciel 2026-03-17 15:49:35 -03:00
parent 430f66d5dd
commit 0a0b0b617b
No known key found for this signature in database
GPG key ID: 33112E6833C34679
24 changed files with 576 additions and 278 deletions

View file

@ -18,8 +18,6 @@ type fileConfig struct {
RepoRoot string `toml:"repo_root"`
LogLevel string `toml:"log_level"`
FirecrackerBin string `toml:"firecracker_bin"`
MapDNSBin string `toml:"mapdns_bin"`
MapDNSDataFile string `toml:"mapdns_data_file"`
SSHKeyPath string `toml:"ssh_key_path"`
NamegenPath string `toml:"namegen_path"`
CustomizeScript string `toml:"customize_script"`
@ -80,12 +78,6 @@ func Load(layout paths.Layout) (model.DaemonConfig, error) {
if file.LogLevel != "" {
cfg.LogLevel = file.LogLevel
}
if file.MapDNSBin != "" {
cfg.MapDNSBin = file.MapDNSBin
}
if file.MapDNSDataFile != "" {
cfg.MapDNSDataFile = file.MapDNSDataFile
}
if file.SSHKeyPath != "" {
cfg.SSHKeyPath = file.SSHKeyPath
}
@ -149,18 +141,9 @@ func Load(layout paths.Layout) (model.DaemonConfig, error) {
}
cfg.MetricsPollInterval = duration
}
if value := os.Getenv("BANGER_MAPDNS_BIN"); value != "" {
cfg.MapDNSBin = value
}
if value := os.Getenv("BANGER_MAPDNS_DATA_FILE"); value != "" {
cfg.MapDNSDataFile = value
}
if value := os.Getenv("BANGER_LOG_LEVEL"); value != "" {
cfg.LogLevel = value
}
if cfg.MapDNSBin == "" {
cfg.MapDNSBin = "mapdns"
}
return cfg, nil
}

View file

@ -127,9 +127,7 @@ func TestLoadFallsBackToLegacyRuntimeLayoutWithoutBundleMetadata(t *testing.T) {
}
}
func TestLoadAppliesMapDNSEnvOverrides(t *testing.T) {
t.Setenv("BANGER_MAPDNS_BIN", "/opt/bin/mapdns")
t.Setenv("BANGER_MAPDNS_DATA_FILE", "/tmp/mapdns-records.json")
func TestLoadAppliesLogLevelEnvOverride(t *testing.T) {
t.Setenv("BANGER_LOG_LEVEL", "debug")
cfg, err := Load(paths.Layout{ConfigDir: t.TempDir()})
@ -137,12 +135,6 @@ func TestLoadAppliesMapDNSEnvOverrides(t *testing.T) {
t.Fatalf("Load: %v", err)
}
if cfg.MapDNSBin != "/opt/bin/mapdns" {
t.Fatalf("MapDNSBin = %q", cfg.MapDNSBin)
}
if cfg.MapDNSDataFile != "/tmp/mapdns-records.json" {
t.Fatalf("MapDNSDataFile = %q", cfg.MapDNSDataFile)
}
if cfg.LogLevel != "debug" {
t.Fatalf("LogLevel = %q", cfg.LogLevel)
}