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
|
|
@ -40,7 +40,6 @@ if [[ ! -d "$RUNTIME_DIR" ]]; then
|
|||
log "run 'make runtime-bundle' or set BANGER_RUNTIME_DIR"
|
||||
exit 1
|
||||
fi
|
||||
source "$RUNTIME_DIR/dns.sh"
|
||||
source "$RUNTIME_DIR/packages.sh"
|
||||
STATE="${BANGER_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/banger/image-build}"
|
||||
VM_ROOT="$STATE/vms"
|
||||
|
|
@ -235,7 +234,6 @@ mkdir -p "$VM_DIR"
|
|||
API_SOCK="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/banger/fc-$VM_TAG.sock"
|
||||
LOG_FILE="$VM_DIR/firecracker.log"
|
||||
TAP_DEV="tap-fc-$VM_TAG"
|
||||
DNS_NAME=""
|
||||
|
||||
# Allocate guest IP
|
||||
NEXT_IP_FILE="$STATE/next_ip"
|
||||
|
|
@ -252,7 +250,6 @@ cleanup() {
|
|||
fi
|
||||
sudo ip link del "$TAP_DEV" 2>/dev/null || true
|
||||
rm -f "$API_SOCK"
|
||||
banger_dns_remove_record_name "${DNS_NAME:-}"
|
||||
rm -rf "$VM_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
@ -340,8 +337,6 @@ fi
|
|||
|
||||
VM_CONFIG_JSON="$(sudo -E curl --unix-socket "$API_SOCK" -sS http://localhost/vm/config)"
|
||||
CREATED_AT="$(date -Iseconds)"
|
||||
DNS_NAME="$(banger_dns_name "$VM_NAME")"
|
||||
banger_dns_write_record "$VM_NAME" "$GUEST_IP"
|
||||
jq -n \
|
||||
--arg id "$VM_ID" \
|
||||
--arg name "$VM_NAME" \
|
||||
|
|
@ -353,9 +348,8 @@ jq -n \
|
|||
--arg log "$LOG_FILE" \
|
||||
--arg rootfs "$OUT_ROOTFS" \
|
||||
--arg kernel "$KERNEL" \
|
||||
--arg dns_name "$DNS_NAME" \
|
||||
--argjson config "$VM_CONFIG_JSON" \
|
||||
'{meta:{id:$id,name:$name,pid:$pid,created_at:$created_at,guest_ip:$guest_ip,tap:$tap,api_sock:$api_sock,log:$log,rootfs:$rootfs,kernel:$kernel,dns_name:$dns_name},config:$config}' \
|
||||
'{meta:{id:$id,name:$name,pid:$pid,created_at:$created_at,guest_ip:$guest_ip,tap:$tap,api_sock:$api_sock,log:$log,rootfs:$rootfs,kernel:$kernel},config:$config}' \
|
||||
> "$VM_DIR/vm.json"
|
||||
|
||||
log "enabling NAT for customization"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue