Configuration reference

Startup environment selects identity, listeners, limits and the source mode. Kubernetes mode reads custom resources; file mode reads one strict JSON document. The configuration schema is v1, custom-resource API dns.tak-os.io/v1alpha1, and peer wire protocol v4. These versions serve different purposes.

See running, Kubernetes resources and record syntax for procedures and complete examples.

Configuration source and document format

Mode Source Selection
Kubernetes DNSZone, DNSRecords, PeerSite and settings in the administration namespace Default when CONFIG_FILE is empty.
File Local JSON file plus a separate TSIG key file Any nonempty CONFIG_FILE; disables all Kubernetes ingestion and CR writes.

Kubernetes DNS definitions are not read from the old ConfigMap config.json. The ConfigMap now contains only data.queryLogging. Install the CRDs before creating resources or starting the workload. A missing settings ConfigMap means logging is false; the app can create it when the setting is first saved.

Kubernetes configuration

DNSZone introduces zone metadata with optional SOA (spec.soa: false by default). DNSRecords groups arbitrary related records: entries need not share owner, type or zone. Its owners must be absolute names ending in a dot. Records are served without any DNSZone, SOA or delegation requirement. PeerSite defines one remote site, optional bootstrap endpoints and a reference to its credential Secret.

All definitions can be owned by UI or GitOps. Update individual objects with optimistic resource versions. The aggregate /api/config is readable, but Kubernetes-mode aggregate PUT is rejected to preserve CR grouping and ownership. Use per-object API writes.

File-mode shape and top-level fields

{
  "version": "v1",
  "zones": [{"name":"example.com.","ttl":60,"soa":false}],
  "records": [{"name":"app.other.example.","type":"A","ttl":60,"value":"192.0.2.10"}],
  "peers": [],
  "queryLogging": false
}

The strict file decoder rejects unknown fields, trailing JSON, malformed field types and unsupported versions. version must be v1; zones, records and peers can be empty. The configuration allows up to 10,000 zones and has no fixed peer-count ceiling; peer IDs must be unique. Catalogue transfers remain bounded by their encoded byte size as described in capacity. A zone name must be unique across the assembled local configuration, including all CRs in the administration namespace. Saving normalizes names, RDATA, TTLs and ordering.

Zone objects

Field Meaning
name Required valid non-root DNS name, lowercased with trailing dot.
ttl Default 60 seconds; maximum 2147483647.
soa Optional Boolean. CRs default false; omitted in legacy file zones preserves generated-SOA compatibility. Set explicitly in new files.
ns Nameserver names; normalization defaults an empty list to ns1.<zone> only when SOA is enabled, then canonicalizes, deduplicates and sorts it. Apex NS records are generated independently of SOA. No address records are synthesized.
admin SOA mailbox in DNS-name form, default hostmaster.<zone>.
records Legacy file-only nested records; CR zone records belong in separate DNSRecords objects.

Parent/child zones retain separate ownership. A zone is optional for ordinary records. DOMAIN controls generated names and does not create a DNSZone.

Static record objects

Field Meaning
name Absolute DNS name for standalone/CR records. Legacy nested file records also support @ and relative names appended to their containing zone.
type A, AAAA, CNAME, DNAME, MX, TXT, NS, SRV, CAA or PTR. SOA is generated from zone settings.
ttl Seconds, maximum 2147483647. Zero/omitted resolves to 60 for standalone records, or the containing zone’s TTL for legacy nested file entries. The normalized value is stored.
value DNS presentation-format RDATA, one line, valid for wire encoding.
zone Optional explicit ownership; if supplied, must name a configured local zone and contain the owner. Without it, the serving view uses the most specific matching zone or the unzoned bucket.
source Runtime-assigned ownership; static input cannot impersonate generated sources.

Multiple distinct CNAME or DNAME targets at one owner are rejected locally. CNAME plus non-address data is rejected. A/AAAA plus CNAME is accepted and masks the CNAME from all query types without deleting its definition. DNAME cannot coexist with a delegation at the same owner. A zone-apex CNAME conflicts with generated NS/SOA. Single-record wire length is capped at 60,000 bytes.

Peer objects

The aggregate/file shape is:

{"id":"site-west","addresses":["192.0.2.20","[2001:db8::20]:53"],"keyName":"site-west.","keySecretRef":"west-tsig","disabled":false}

id is the expected remote site identity, case-sensitive, 1–128 ASCII letters, digits, -, _ or .. At most 256 literal-IP endpoints are allowed; an empty list is valid for discovery/pending/disabled states. Bare IPs use port 53; explicit ports are 1–65535. Hostnames are rejected and order is retained. keyName is optional legacy file-mode key selection. Kubernetes uses the referenced Secret’s key name. keySecretRef selects an administration-namespace Secret, default tak-os-dns-peer- plus the first 16 hexadecimal characters of SHA-256(peer ID). A remote key reference cannot alias the local TSIG Secret. disabled removes effective endpoints. Local identity matches and authenticated self-endpoints are quarantined; see peers. Configured bootstrap addresses are validated even while a site is disabled, quarantined or using discovered endpoints; status cannot hide an invalid spec.

Environment

Empty environment values use the listed default where a default exists. All application environment settings are read at startup; changing a DaemonSet's environment requires new pods.

Variable Default Meaning and validation
CLUSTER_ID Required Stable local identity shared by its replicas. 1–128 ASCII letters, digits, -, _ or .; no whitespace trimming is applied.
DOMAIN Required Suffix for generated Service names and bare Node names. Canonicalized to lowercase with a trailing dot; must be a valid non-root DNS name.
EXTIPS Empty Legacy address list used only for file-mode topology self-advertisement, not Kubernetes Ingress generation: JSON array of strings or comma-separated IPs. Whitespace around individual IPs is trimmed; IPv4 and IPv6 are accepted and canonicalized. Invalid entries reject startup.
EXTIP Empty Deprecated fallback used only when EXTIPS is empty. Same parsing and validation.
POD_NAMESPACE default Administration namespace for DNSZone, DNSRecords, PeerSite, Secrets and settings; generated sources are read across all namespaces. In kubeconfig mode, the current-context namespace replaces this value when its effective value is default.
CONFIGMAP_NAME tak-os-dns Name of the query-logging settings ConfigMap; DNS definitions are custom resources.
CONFIG_FILE Unset File-mode path; disables Kubernetes ingestion when nonempty.
KUBECONFIG Unset Path to one kubeconfig file. A multi-file path list and credential plugins are unsupported.
KUBE_API_URL Unset Explicit http or https Kubernetes API base URL; takes precedence over the kubeconfig's server address.
DNS_ADDR :53 Shared UDP/TCP DNS bind address, using Go's host:port listener syntax.
HTTP_ADDR :8080 Internal management HTTP bind address.
DNS_SERVICE_NAME tak-os-dns Administration-namespace DNS Service used to select advertised node ExternalIPs.
LOCAL_TSIG_SECRET tak-os-dns-tsig Kubernetes Secret holding this site’s inbound key; created if absent at initial startup.
TSIG_FILE <CONFIG_FILE>.tsig.json Reloadable local/remote key store in file mode; generated with mode 0600 when absent.
PEER_KEYS_FILE Unset Legacy startup-only outbound key-name/base64 map for file mode; entries must decode to at least 16 bytes. Prefer the reloadable TSIG store.
POLL_INTERVAL 10s Configuration recovery and complete local resource refresh interval.
PEER_INTERVAL 30s Periodic peer synchronization interval.
PEER_TIMEOUT 3s Deadline for each peer endpoint attempt, including a complete paginated transfer; also bounds notification attempts.
SHUTDOWN_TIMEOUT 10s Listener and worker draining deadline after shutdown starts.
MAX_RECORDS 100000 Maximum normalized source contributions retained across local and imported snapshots; shared effective records can have several source contributions.
MAX_CONCURRENT 256 DNS in-flight query bound and TCP connection bound.
QUERY_RATE 100 Token refill rate per observed client source IP, in requests/second. Must be finite, greater than zero and at most 1e9.
QUERY_BURST 200 Initial/maximum tokens per source; positive integer.
POD_NAME HOSTNAME, then local Pod identity returned in management responses and diagnostics.
HOSTNAME local fallback Used only when POD_NAME is empty.
KUBERNETES_SERVICE_HOST None In-cluster API host, used only without KUBECONFIG or KUBE_API_URL.
KUBERNETES_SERVICE_PORT 443 In-cluster API port, under the same selection rule.

Duration values use Go duration syntax, for example 500ms, 10s or 2m, and must be at least 1ms. Integer limits must be positive integers. Listener bind errors fail startup. The process has no command-line configuration flags.

EXTIPS remains accepted for file-mode topology self-advertisement; it does not control Kubernetes Ingress records, mutate the DNS Service or allocate IP addresses. Ingress hosts use CNAMEs selected by annotated controller Services and explicit spec.ingressClassName; see Kubernetes annotations. DNS Service external IPs are maintained separately for the intended node endpoints.

Kubernetes endpoint and credential precedence

When CONFIG_FILE is nonempty, no Kubernetes client is created and the following credential choices are irrelevant to configuration/discovery.

  1. With KUBECONFIG, load its current-context, cluster and user. Use KUBE_API_URL as the endpoint if set; otherwise use that cluster's server. The selected kubeconfig still supplies credentials and CA settings when the endpoint is overridden. A missing current-context cluster is an error.
  2. Without KUBECONFIG, an explicit KUBE_API_URL selects that endpoint without automatically loading ServiceAccount credentials or CA material. This is the mode used with a separately authenticated local kubectl proxy.
  3. With neither, construct an HTTPS endpoint from KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT, and use the standard projected ServiceAccount token and CA files under /var/run/secrets/kubernetes.io/serviceaccount/.

Supported kubeconfig user credentials are a literal token, tokenFile, and client-certificate/client-key files or their base64 *-data equivalents. Embedded certificate/CA data takes precedence over its corresponding file path. Relative credential file paths are resolved against the kubeconfig directory. A token file takes precedence over a literal token and is reread on each API request, including the projected in-cluster token. Certificates, trust material and kubeconfig selection are loaded at startup. Exec/auth-provider plugins and insecure-skip-tls-verify are rejected. HTTPS requires TLS 1.2 or newer and uses system trust plus an explicitly supplied CA when present. The HTTP transport also honours Go's standard proxy environment (HTTP_PROXY, HTTPS_PROXY, NO_PROXY, including supported lowercase forms).

The kubeconfig context namespace is used when POD_NAMESPACE has its default effective value default, even if that literal value was explicitly set. Choose a different namespace explicitly or adjust the context to avoid ambiguity.

Reloadable TSIG credentials

Each local/remote credential consists of keyName, algorithm (exactly hmac-sha256.) and secret (nonempty standard-base64 key). These are text values in Kubernetes Secret stringData, then base64-encoded by Kubernetes storage. The TSIG secret value is already base64, so do not confuse the two layers. Generated keys contain 32 cryptographically random bytes. Keys shorter than 16 decoded bytes are accepted with a UI warning. No external generator or key service is required.

The app creates the local Secret only when absent and no valid local key has yet been loaded. A pre-existing Secret is never overwritten merely because it is invalid. Every local poll reloads the local key and all configured remote keys. Valid changes replace active keys without pod restart; malformed updates retain the last valid key and expose an error. Deleting a remote credential makes its site pending on reload. Deleting an already-loaded local Secret retains the last key and reports failure; it is not silently recreated during that process.

File mode uses TSIG_FILE, default <CONFIG_FILE>.tsig.json:

{"local":{"keyName":"site-east.","algorithm":"hmac-sha256.","secret":"MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY="},"peers":{}}

It is created exclusively when absent initially, uses owner-only permissions, and reloads each local cycle. UI changes save atomically. File reads and JSON management writes have separate size limits described below.

Reload, validation and concurrency

Setting Runtime handling
CR definitions and query logging Complete reads by the configuration worker (one-second change detection) and local reconciliation (POLL_INTERVAL); CRUD triggers reload.
Generated records Complete resource lists each local refresh; incomplete/failed reads retain the previous local snapshot.
Local/remote keys Re-read on each local cycle, immediately after key API writes, then trigger peer refresh.
Environment/listeners/identity Startup-only.
Remote DNS records Direct peer refresh, in-memory only.
Discovered site metadata Authenticated topology refresh, persisted to PeerSite status.

Whole assembled candidates are validated before publication. Invalid definitions retain the last good configuration/snapshot and expose configError; initial readiness waits for valid configuration and complete local synchronization. Kubernetes observations across resource kinds are not a cross-object transaction.

File PUT /api/config requires the SHA-256 hash of the current file bytes as its resourceVersion. Saves check normalized/indented JSON plus newline before an atomic owner-only temporary-file replacement. The parent directory must be writable. CR writes use each object’s Kubernetes metadata.resourceVersion; updates preserve existing metadata/status, while discovery writes only status. Stale writes return 409. GitOps reconciliation may intentionally replace UI edits.

Size and resource limits

Configuration/resource JSON request bodies are limited to 2 MiB. Key writes are limited to 8192 bytes and settings writes to 4096 bytes. Decoding failures return 400, including oversized bodies; application writes need application/json. The key-file reader caps bytes at 2 MiB. Config-file saves enforce the final encoded 2 MiB bound before replacing existing content. Kubernetes object limits remain independent; API response decoding is limited to 32 MiB.

CR schema limits include 100,000 records per DNSRecords object and 256 endpoints per PeerSite. The model also caps source snapshots at 1,000,000 input records; MAX_RECORDS applies a usually lower combined source-contribution budget. Failed replacements preserve the serving state. See capacity.

Serving policy independent of SOA

DNSZone and SOA creation are optional for cached positive answers. A known owner without the requested type receives authoritative NOERROR/NODATA; its selected zone's SOA is included only when enabled. Completely unknown names receive REFUSED and never NXDOMAIN, even beneath SOA. This missing-type policy normally terminates resolver fallback for that type, supporting single-family musl lookups while requiring equivalent mesh views for reliable nameserver failover. RD-aware delegation handling and alias rules are in DNS behaviour; actual client observations are in resolver compatibility.

Known-name existence comes from effective RR owners/wildcard synthesis, or empty non-terminals established by data inside an explicit zone. Unzoned inferred ancestors remain unknown. A DNSZone with soa=false and no NS/RR data does not create a known apex just by existing; enabling SOA or supplying actual records establishes that owner. See the exact boundary.

For an independently known owner below a parent delegation, missing-type NODATA does not attach the parent's SOA. Only an applicable uncut zone can supply SOA authority; independent existence does not promote an existing parent-owned glue RRset into an authoritative answer.