Fix zone provisioning: seed glue + IP primaries #3

Merged
benvin merged 1 commits from benvin/fix-zone-seed into main 2026-07-03 21:39:46 +10:00
Owner

Fixes two bugs that made every provisioned zone fail to load (seen on ns-auth).

Bug 1 — primary zones don't load

The seed zone's apex NS ns1.<zone> is in-zone but had no address record, so BIND check-integrity refuses it:

zone unkin.net/IN: NS 'ns1.unkin.net' has no address records (A or AAAA)
zone unkin.net/IN: not loaded due to errors.  addzone failed; reverting.

Fix: the seed writes a glue ns1 IN A <primaryIP>.

Bug 2 — secondaries crash-loop

Secondaries rendered primaries/default-primaries with the primary's DNS name, but BIND only accepts IP addresses there (it read the name as a remote-servers list):

named.conf:24: unable to find remote-servers list 'auth-0.auth-headless.ns-auth.svc.cluster.local'
loading configuration: failure — exiting (due to fatal error)

Fix: render the primary pod IP, and watch Pods so the config re-renders when it appears/changes.

Changes

  • bind.WriteSeedZone writes glue ns1 IN A <primaryIP>
  • zone/catalog/policy controllers resolve primaryPodIP and pass it to the seed (requeue if the primary has no IP yet)
  • BindCluster renders PrimaryAddress from pod-0's IP and .Watches(&corev1.Pod{})
  • render omits catalog primaries when the IP is unknown (no invalid empty primaries {})
  • unit tests for the render guards

Follow-up

Merge + tag v0.1.2; then bump the operator image v0.1.1 -> v0.1.2 in argocd-apps (apps/base/bind-system/deployment.yaml).

Fixes two bugs that made **every** provisioned zone fail to load (seen on ns-auth). ## Bug 1 — primary zones don't load The seed zone's apex `NS ns1.<zone>` is in-zone but had no address record, so BIND `check-integrity` refuses it: ``` zone unkin.net/IN: NS 'ns1.unkin.net' has no address records (A or AAAA) zone unkin.net/IN: not loaded due to errors. addzone failed; reverting. ``` Fix: the seed writes a glue `ns1 IN A <primaryIP>`. ## Bug 2 — secondaries crash-loop Secondaries rendered `primaries`/`default-primaries` with the primary's DNS name, but BIND only accepts **IP addresses** there (it read the name as a remote-servers list): ``` named.conf:24: unable to find remote-servers list 'auth-0.auth-headless.ns-auth.svc.cluster.local' loading configuration: failure — exiting (due to fatal error) ``` Fix: render the primary **pod IP**, and watch Pods so the config re-renders when it appears/changes. ## Changes - `bind.WriteSeedZone` writes glue `ns1 IN A <primaryIP>` - zone/catalog/policy controllers resolve `primaryPodIP` and pass it to the seed (requeue if the primary has no IP yet) - `BindCluster` renders `PrimaryAddress` from pod-0's IP and `.Watches(&corev1.Pod{})` - render omits catalog primaries when the IP is unknown (no invalid empty `primaries {}`) - unit tests for the render guards ## Follow-up Merge + tag **v0.1.2**; then bump the operator image v0.1.1 -> v0.1.2 in argocd-apps (`apps/base/bind-system/deployment.yaml`).
unkinben added 1 commit 2026-07-03 21:33:48 +10:00
Fix zone provisioning: seed glue + IP primaries
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
fb103a9e95
Two bugs made every provisioned zone fail to load:

1. The seed zone's apex NS (ns1.<zone>) is in-zone but had no address
   record, so BIND check-integrity refused to load it and rndc addzone
   reverted. Add a glue A record pointing at the primary pod IP.
2. Secondaries rendered primaries/default-primaries with the primary's
   DNS name, but BIND only accepts IP addresses there (it read the name
   as a remote-servers list and failed config load, crash-looping the
   secondary). Render the primary pod IP instead, and watch Pods so the
   config re-renders when that IP appears or changes.

- bind.WriteSeedZone writes 'ns1 IN A <primaryIP>' glue
- controllers resolve primaryPodIP and pass it to the seed (requeue if
  the primary has no IP yet)
- BindCluster renders PrimaryAddress from pod-0's IP and watches Pods
- render omits catalog primaries when the IP is unknown (no empty list)
benvin merged commit cd25c94efc into main 2026-07-03 21:39:46 +10:00
benvin deleted branch benvin/fix-zone-seed 2026-07-03 21:39:46 +10:00
Sign in to join this conversation.