Fix zone provisioning: seed glue + IP primaries
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)
This commit is contained in:
@@ -53,6 +53,33 @@ func TestRenderCatalogOnSecondaryOnly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderCatalogOmittedWhenPrimaryIPUnknown(t *testing.T) {
|
||||
// Primary IP not known yet and no explicit default-primaries: the secondary
|
||||
// must not emit a catalog-zones / secondary catalog zone with an empty
|
||||
// primaries list (which BIND rejects at config load).
|
||||
in := RenderInput{
|
||||
Cluster: newCluster(bindv1alpha1.ModeAuthoritative),
|
||||
Catalog: &bindv1alpha1.BindCatalogZone{Spec: bindv1alpha1.BindCatalogZoneSpec{ZoneName: "catalog.internal"}},
|
||||
PrimaryAddress: "",
|
||||
}
|
||||
_, secondary := RenderNamedConf(in)
|
||||
if strings.Contains(secondary, "catalog-zones") || strings.Contains(secondary, "primaries {") {
|
||||
t.Fatalf("secondary must omit catalog primaries when the primary IP is unknown:\n%s", secondary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderCatalogUsesPrimaryIP(t *testing.T) {
|
||||
in := RenderInput{
|
||||
Cluster: newCluster(bindv1alpha1.ModeAuthoritative),
|
||||
Catalog: &bindv1alpha1.BindCatalogZone{Spec: bindv1alpha1.BindCatalogZoneSpec{ZoneName: "catalog.internal"}},
|
||||
PrimaryAddress: "10.42.0.7",
|
||||
}
|
||||
_, secondary := RenderNamedConf(in)
|
||||
if !strings.Contains(secondary, "primaries { 10.42.0.7; }") {
|
||||
t.Fatalf("secondary should point primaries at the primary pod IP:\n%s", secondary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderACL(t *testing.T) {
|
||||
in := RenderInput{
|
||||
Cluster: newCluster(bindv1alpha1.ModeAuthoritative),
|
||||
|
||||
Reference in New Issue
Block a user