Add AddressOverride and DomainRule objects for what lived in a ConfigMap and the config file

The address redirects page rewrote an RPZ ConfigMap through the resolver's own
service account, and the domains page rewrote allow_entries/block_entries in the
config file. Both become cluster objects like the rest.

AddressOverride is one name answered with fixed addresses (the name and
everything under it), exactly what an RPZ "name A address" line did. DomainRule
is a block or allow list of inline names. The resolver reads both with the
existing watch: overrides are rendered into the managed RPZ source the blocklist
manager already has, and rule names join the config's inline entries in the
merged overlay, so the file's config is never written to.

Names are checked to be DNS names or wildcard patterns before they are used,
because they are joined into line-oriented parser input and a newline or a
comment character in one would otherwise add a rule of its own.

The console edits both: the address-overrides and domains endpoints now write
objects. The console keeps its added rules in one DomainRule per action
(inline-block, inline-allow) instead of an object per name, and removes a name
from whichever DomainRule holds it, wildcard or not. An end-to-end test drives
the pages' endpoints and checks the resolver's answers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
matsandClaude Sonnet 5.5 committed 2026-10-16 10:08:08 +02:00
1 parent 7fd6a7e7a5
commit 88479b9a12
19 files changed
+912 -18

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@ metadata:
namespace: dns
rules:
- apiGroups: [fancydns.k6n.net]
resources: [dnszones, clientgroups, blocklists]
resources: [dnszones, clientgroups, blocklists, addressoverrides, domainrules]
verbs: [get, list, create, update, delete]
---
apiVersion: rbac.authorization.k8s.io/v1
+63
View File
@@ -122,3 +122,66 @@ spec:
categories: {type: array, items: {type: string}}
comment: {type: string, maxLength: 512}
insecure_skip_tls_verify: {type: boolean}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: addressoverrides.fancydns.k6n.net
spec:
group: fancydns.k6n.net
scope: Namespaced
names: {kind: AddressOverride, listKind: AddressOverrideList, plural: addressoverrides, singular: addressoverride, shortNames: [ao]}
versions:
- name: v1alpha1
served: true
storage: true
additionalPrinterColumns:
- {name: Domain, type: string, jsonPath: .spec.domain}
- {name: Addresses, type: string, jsonPath: .spec.addresses}
- {name: Age, type: date, jsonPath: .metadata.creationTimestamp}
schema:
openAPIV3Schema:
type: object
required: [spec]
properties:
spec:
type: object
required: [domain, addresses]
properties:
domain: {type: string, minLength: 1, maxLength: 253, description: "Answered with the addresses below, together with every name under it"}
addresses:
type: array
minItems: 1
maxItems: 16
items: {type: string, description: "IPv4 or IPv6 literal"}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: domainrules.fancydns.k6n.net
spec:
group: fancydns.k6n.net
scope: Namespaced
names: {kind: DomainRule, listKind: DomainRuleList, plural: domainrules, singular: domainrule, shortNames: [dr]}
versions:
- name: v1alpha1
served: true
storage: true
additionalPrinterColumns:
- {name: Action, type: string, jsonPath: .spec.action}
- {name: Age, type: date, jsonPath: .metadata.creationTimestamp}
schema:
openAPIV3Schema:
type: object
required: [spec]
properties:
spec:
type: object
required: [action, names]
properties:
action: {type: string, enum: [block, allow], description: "allow rescues a name that a blocklist would block"}
names:
type: array
maxItems: 5000
items: {type: string, description: "A name, or *.name (subdomains) / **.name (subdomains and the name)"}
comment: {type: string, maxLength: 512}
+18
View File
@@ -34,3 +34,21 @@ spec:
format: hosts
refresh: 24h
categories: [ads, malware]
---
apiVersion: fancydns.k6n.net/v1alpha1
kind: AddressOverride
metadata:
name: k6n-net
namespace: dns
spec:
domain: k6n.net
addresses: [10.10.3.10]
---
apiVersion: fancydns.k6n.net/v1alpha1
kind: DomainRule
metadata:
name: inline-block
namespace: dns
spec:
action: block
names: ["*.tracker.example"]
+1 -1
View File
@@ -8,7 +8,7 @@ metadata:
namespace: dns
rules:
- apiGroups: [fancydns.k6n.net]
resources: [dnszones, clientgroups, blocklists]
resources: [dnszones, clientgroups, blocklists, addressoverrides, domainrules]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1