Render forward zones into named.conf on every pod
type:forward zones are pure configuration (conditional forwarding), not replicated data, so a resolver needs them on all pods. They were being rndc-addzone'd on the primary only, so queries hitting a secondary pod missed the forwarding. Render them into named.conf instead. - render forward zones inside their view (or top-level when no views) - BindCluster lists type:forward zones and watches BindZone to re-render - BindZone controller skips forward zones (config-managed, no addzone) - unit test for forward-zone-in-view rendering
This commit is contained in:
@@ -80,6 +80,29 @@ func TestRenderCatalogUsesPrimaryIP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderForwardZoneInView(t *testing.T) {
|
||||
rec := true
|
||||
in := RenderInput{
|
||||
Cluster: newCluster(bindv1alpha1.ModeResolver),
|
||||
Views: []bindv1alpha1.BindView{{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "openforwarder"},
|
||||
Spec: bindv1alpha1.BindViewSpec{ClusterRef: "auth", MatchClients: []string{"acl-main"}, Recursion: &rec},
|
||||
}},
|
||||
Forwards: []bindv1alpha1.BindZone{{
|
||||
Spec: bindv1alpha1.BindZoneSpec{ClusterRef: "auth", ZoneName: "unkin.net", Type: bindv1alpha1.ZoneForward, ViewRef: "openforwarder", Forwarders: []string{"198.18.19.15"}},
|
||||
}},
|
||||
}
|
||||
primary, secondary := RenderNamedConf(in)
|
||||
for _, out := range []string{primary, secondary} {
|
||||
if !strings.Contains(out, `view "openforwarder"`) {
|
||||
t.Fatalf("view missing:\n%s", out)
|
||||
}
|
||||
if !strings.Contains(out, `zone "unkin.net" {`) || !strings.Contains(out, "type forward;") || !strings.Contains(out, "forwarders { 198.18.19.15; }") {
|
||||
t.Fatalf("forward zone not rendered inside view (must be on all pods):\n%s", out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderACL(t *testing.T) {
|
||||
in := RenderInput{
|
||||
Cluster: newCluster(bindv1alpha1.ModeAuthoritative),
|
||||
|
||||
Reference in New Issue
Block a user