Management HTTP API

The embedded console, JSON API, probes and metrics share the internal HTTP listener selected by HTTP_ADDR (default :8080). They do not use the DNS listener. TLS and user authentication belong to the management Ingress or another trusted access layer; the application does not implement user accounts, API tokens or authorization roles. See security.

Routes are implemented in the web server, DNS validation and application hooks. Console workflows are in using the console. This reference describes the interface, not deployment or access setup.

Endpoint inventory

Method Path Successful response Scope
GET, HEAD /, /app.js, /styles.css 200, embedded console/assets Pod-local static content.
GET /api/config 200, {config, resourceVersion, podID} Aggregate CR configuration or local file; no credentials.
PUT /api/config 200, {config, resourceVersion, podID} File mode only: replaces complete file using an optimistic version.
GET /api/resources 200, source mode and complete resource collection Shared Kubernetes definitions or file configuration.
POST, PUT, DELETE /api/resources/{plural}/{namespace}/{name} 201 create, 200 update/delete Individual DNSZone/DNSRecords/PeerSite CRUD.
GET, PUT /api/settings 200, {queryLogging,resourceVersion} Persistent shared logging setting.
GET /api/keys 200, key summaries and versions No secret values in summaries.
POST /api/keys/local/export 200, {keyName,algorithm,secret} Explicit private local key export.
POST /api/keys/local/rotate 200, updated key summaries Generates/replaces local key.
PUT /api/keys/local 200, updated key summaries Imports/replaces local key.
PUT /api/keys/peers/{siteID} 200, updated key summaries Saves destination site's credential locally.
GET /api/records 200, {records, podID} Responding pod's merged per-zone record view.
GET /api/status 200, {status, podID} Responding pod's runtime/local-source status.
GET /api/peers 200, {peers, podID} Responding pod's transfer statuses.
POST /api/peers/{clusterID}/sync 202, {status:"queued", peer} Queues a forced full transfer on this pod.
POST /api/validate 200, diagnostic result object DNS diagnostic originating on this pod.
GET /livez 200, plain text ok\n Process HTTP endpoint liveness.
GET /readyz 200, plain text ready\n, or 503 while unavailable Pod readiness.
GET /metrics 200, Prometheus text exposition Pod-local counters/gauges/histogram.

Probe/metrics routes are intended for GET; unlike the JSON routes, their handlers do not enforce a method-specific allow list. Static files support HEAD. Unknown /api/ routes return a JSON 404; unknown static paths use the HTTP file server's 404 response. There is no HTTP endpoint that exports peer DNS snapshots, performs per-record PATCH, clears a source watermark or enables DNS recursion. The explicit local key-export route does return private key material.

JSON, browser checks and limits

Body-bearing configuration and validation requests require Content-Type: application/json (a charset parameter is accepted). The decoder rejects unknown fields, malformed JSON and more than one JSON value. The sync endpoint needs no body and does not require a Content-Type header.

Successful JSON responses and API errors use application/json. API errors have this shape:

{"error":"configuration changed; reload before saving"}

All routes set Cache-Control: no-store, X-Content-Type-Options: nosniff, a same-origin referrer policy and a Content Security Policy restricting assets and connections to the same origin and disallowing framing, objects and base URLs. For methods other than GET/HEAD, a supplied Origin must use HTTP or HTTPS and its host/port must match the request Host. Sec-Fetch-Site: cross-site is also rejected. These checks are browser protections, not authentication: clients without those headers still require protection at the trusted access layer. An Ingress/proxy must preserve a consistent external Host for browser writes.

Bound Value
Configuration PUT body 2 MiB (2097152 bytes), including wrapper.
Validation POST body 4096 bytes.
Resource write body 2 MiB.
Key write body 8192 bytes.
Settings write body 4096 bytes.
HTTP header bytes 32768.
Read-header timeout 5 seconds.
Request read timeout 15 seconds.
Response write timeout 30 seconds.
Idle connection timeout 60 seconds.

Configuration backend/file limits are described in configuration. The API has no pagination/filter parameters for record or status responses; filtering in the console is performed in the browser after fetching records.

Read and replace configuration

GET /api/config returns {config,resourceVersion,podID}. In Kubernetes the configuration is assembled from CRs/settings and its version is a SHA-256 digest of that resource view; in file mode the version is a SHA-256 of exact file bytes. Neither includes key material. Read/validation failures return 503 while last-good runtime data remains inspectable under status.

PUT /api/config is supported only in file mode. It accepts the complete config and previously read version:

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

A successful file save returns normalized config/new version/podID. Missing version returns 400; stale version returns 409. The final encoded file must fit 2 MiB and is replaced atomically. Omitting prior entries removes them. Kubernetes aggregate PUT is rejected (503) with guidance to update individual resources; there is no bulk rewrite that loses administrative grouping or ownership.

Custom-resource management

GET /api/resources in Kubernetes returns:

{"mode":"kubernetes","resources":{"zones":[],"records":[],"peers":[],"versions":{},"queryLogging":false},"namespace":"tak-os-dns","podID":"POD"}

Each resource contains apiVersion, kind, metadata, spec, and optional status. Collections are sorted by namespace/name. versions includes collection and object UID watermarks. File mode returns {mode:"file",config,resourceVersion,podID} instead.

POST /api/resources/dnsrecords/tak-os-dns/platform-extras creates an individual CR; PUT replaces that object's spec and DELETE removes it. Plurals are dnszones, dnsrecords and peersites. All three kinds must use the administration namespace (POD_NAMESPACE); requests targeting another namespace return HTTP 400. Path name/namespace must agree with supplied metadata. Create/update body is the resource itself:

{"apiVersion":"dns.tak-os.io/v1alpha1","kind":"DNSRecords","metadata":{"name":"platform-extras","namespace":"tak-os-dns"},"spec":{"records":[{"name":"api.example.com.","type":"A","ttl":60,"value":"192.0.2.40"}]}}

Create does not require resourceVersion and ignores supplied status. Update must include metadata.resourceVersion; it preserves existing metadata and status. Supplied status does not participate in spec validation: aggregate validation uses empty status for a new object and the stored status for an update. Peer bootstrap fields must be valid even when discovered endpoints, disabling or quarantine make them inactive. Delete requires {"resourceVersion":"CURRENT_OBJECT_VERSION"} and uses Kubernetes delete preconditions. Conflicts return 409; Kubernetes API failures are propagated where available. Successful replies contain {resource,podID} (the resource is empty for deletion). They trigger local configuration/key reload; serving still waits for complete reconciliation. File mode CR writes return 400. For UI/API creates, updates and deletes, a previously valid aggregate is also validated with the proposed change before Kubernetes is written. Duplicate zone names/site IDs, cross-group CNAME conflicts and removing a zone still explicitly referenced by a record return HTTP 400. Single-object validation checks syntax; full aggregate validation establishes explicit-zone existence. When the current aggregate is already invalid, individual valid repairs may be saved without requiring every unrelated error to be fixed in one operation. GitOps and concurrent cross-pod edits can still create an invalid assembled candidate; local reconciliation detects it and retains the last-good serving state. Per-object resource versions do not provide a cross-object transaction.

TSIG key management

GET /api/keys returns local/peer summaries, local resourceVersion, local secretName and an error string for reload problems. Each summary contains keyName, algorithm, present, a short SHA-256 fingerprint, weak and decoded bytes. Peer summaries include their Secret resourceVersion. Summaries never return the secret. A weak key means fewer than 16 decoded bytes; nonempty short keys are accepted with a warning. Disabled Kubernetes peers still expose the existing Secret's resource version so credentials can be replaced before enabling peering. Their summaries report present:false because the key is inactive; this does not imply the Secret is absent.

POST /api/keys/local/export explicitly returns this private bundle (no request body required):

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

This example is not a production credential. Export is privileged private data, protected by the same externally authenticated management route as every API. It is never included in peer discovery or ordinary DNS replies.

PUT local/peer key routes accept these three fields plus resourceVersion. The algorithm must be HMAC-SHA256, the key name a valid DNS name and secret nonempty standard base64. A remote credential cannot reference/overwrite the local site Secret. For existing Kubernetes Secrets use their current version; for a new remote credential use empty version. A stale/missing required version returns 409. The application preserves unrelated Secret data/metadata. In file mode use the key-file version, not the config-file version.

POST /api/keys/local/rotate accepts {"resourceVersion":"CURRENT_VERSION"}, generates 32 random bytes and saves the replacement. Valid API writes immediately reload keys on the responding pod; other pods reload on their local cycles. Previous local key stops authenticating after reload. There is no overlap period or automatic remote update. Already imported remote records remain retained. UI, GitOps and ESO may manage Secrets; invalid external changes retain the last valid key and report errors. See peers.

Persistent logging setting

GET /api/settings returns {queryLogging,resourceVersion}. PUT accepts:

{"queryLogging":true,"resourceVersion":"CURRENT_SETTINGS_VERSION"}

Kubernetes stores only this setting in the named ConfigMap. A missing object can be created with empty version; updates need its current resourceVersion. Unrelated fields survive. File mode saves this field in the config using the file version. There is no automatic logging timeout. Saving a setting can conflict with GitOps.

Inspect records

Example GET /api/records response:

{
  "records":[{
    "zone":"example.com.",
    "name":"payments.production.example.com.",
    "type":"A", "ttl":60, "value":"192.0.2.20",
    "source":"cluster-east/service/OBJECT_UID,cluster-west/static"
  }],
  "podID":"tak-os-dns-abc123"
}
Record field Meaning
zone Owning authoritative zone. Parent glue and child records can have the same owner but different zones.
name Canonical absolute owner name.
type RR type, uppercase.
ttl Effective RRset TTL, using the minimum contributing TTL.
value Canonical DNS presentation RDATA.
source Cluster/source ownership, combined when records deduplicate. Static source is static; generated sources contain object kind and UID.

This is the merged per-zone contribution view. It excludes masked CNAMEs and synthetic apex SOA/NS entries created solely from zone metadata. Explicit static NS contributions remain visible. Source definitions hidden by masking remain in configuration or their retained source snapshot; local static definitions can be inspected through /api/config. Parent-owned glue in this response does not become authoritative data for a separately hosted child zone. An empty record collection may serialize as null.

Inspect runtime status

Example GET /api/status response:

{
  "podID":"tak-os-dns-abc123",
  "status":{
    "clusterID":"cluster-east",
    "podID":"tak-os-dns-abc123",
    "configVersion":"48292",
    "localSynced":true,
    "lastSync":"2026-11-05T10:00:00Z",
    "lastError":"",
    "configError":"",
    "ready":true,
    "records":12,
    "revision":"LOCAL_SOURCE_SHA256_FINGERPRINT"
  }
}
Status field Meaning
clusterID Startup cluster identity.
podID Responding pod identity; also present in the outer object.
configVersion Last accepted assembled CR digest or file hash.
localSynced At least one valid complete local source snapshot has been published. Later source failures retain this state.
lastSync Time of the latest successful local publication/refresh.
lastError Latest local source-refresh error; cleared by a successful local refresh.
tsig Local/remote key summaries, resource versions and reload errors; never secret values.
discoveryError Local advertised-endpoint/topology read failure; previous local advertisement is retained. Distinct from each peer’s remote discoveryError.
configError Configuration rejection/read/change-detection error, maintained separately from source-refresh errors. Cleared by successful configuration acceptance.
ready Configuration/local-source/initial-peer-attempt readiness summary. Use /readyz for the actual shutdown-aware readiness probe.
records Count of the merged per-zone record entries returned by the cache's record view, excluding synthetic zone metadata.
revision Local source content fingerprint. It excludes imported data and source-version-only changes; compare peer statuses separately for import convergence.

Times are JSON RFC3339 timestamps; an operation that has never occurred can have the zero timestamp 0001-01-01T00:00:00Z. This status is not a durable history.

Inspect and refresh peers

Example GET /api/peers response:

{
  "podID":"tak-os-dns-abc123",
  "peers":[{
    "id":"cluster-west", "endpoint":"192.0.2.20:53",
    "attempted":true, "success":true,
    "lastAttempt":"2026-11-05T10:00:00Z",
    "lastSuccess":"2026-11-05T10:00:00Z",
    "revision":"REMOTE_SOURCE_SHA256_FINGERPRINT",
    "transfers":4, "failures":0
  }]
}
Peer field Meaning
id Expected source-site identity (configured or discovered).
endpoint Last successful endpoint, initially empty. It may still name the previous successful endpoint after a failed pass.
pendingCredentials Credential missing; no unauthenticated transfer attempted.
disabled Self or administratively disabled; no effective endpoints.
reason Pending/disabled/latest failure explanation.
discoveryError Topology network/persistence failure, independent of successful record transfer.
attempted An initial ordered synchronization pass has completed, successfully or unsuccessfully.
success Latest completed synchronization pass succeeded.
lastAttempt Completion time of the latest pass.
lastSuccess Latest successful synchronization time.
error Latest failure text; omitted when empty.
revision Last accepted source content fingerprint; omitted before one is known.
transfers Successful synchronization passes, including unchanged-content responses.
failures Failed complete passes, rather than a count of every failed endpoint.

Peer statuses are sorted by identity. Failed refreshes retain prior data and revision; success: false is not evidence of record deletion.

POST /api/peers/cluster-west/sync needs no body and responds:

{"status":"queued","peer":"cluster-west"}

The 202 response means a forced full re-transfer was queued on the responding pod. It does not wait for network completion. The selected peer's transfer base is cleared, while current serving records and rollback-protection watermarks are retained. The bounded worker can also digest-poll other peers during that pass. Unknown peers return 400. There is no single HTTP “all peers” endpoint; the console queues one request per configured peer. See peer administration.

DNS query validation

POST /api/validate accepts:

{"name":"www.example.com.","types":["A","AAAA"]}

name is required, trimmed and canonicalized. Root, wildcard names, backslash escapes and names containing spaces/tabs/newlines are rejected; the canonical name must be a valid DNS name no longer than 254 text bytes. types may be omitted, null or empty to request A, AAAA, CNAME. At most 11 supplied entries are accepted before deduplication. Types are uppercased and deduplicated, retaining first occurrence order. Allowed values are A, AAAA, CNAME, DNAME, MX, TXT, NS, SOA, SRV, CAA and PTR.

The resolver list is fixed: the responding pod's local DNS listener with RD disabled, 8.8.8.8:53 with RD enabled, and 1.1.1.1:53 with RD enabled. The API does not accept resolver addresses. Public diagnostics need outbound UDP/TCP 53; this does not add forwarding or recursion to the DNS server.

There are at most four concurrent validation requests per HTTP handler/pod. A fifth returns 429 rather than waiting. Accepted requests run resolver/type pairs concurrently, with an 8-second overall context. Each DNS exchange has a 2-second timeout, starts over UDP with EDNS size 1232 and retries over TCP on truncation. Recursive diagnostics can make the initial query plus up to eight subsequent alias-query steps within the overall deadline. Loops/excessive chains return an individual result error. The local diagnostic preserves an authoritative external-target CNAME-only response instead of querying the local server again for an out-of-zone target and misleadingly reporting REFUSED.

The response has these fields:

Field Shape and meaning
name Canonical queried name.
podID Pod whose listener was queried as local.
results One result per resolver/type pair: resolver, type, rcode, answers, cnameChain, optional error, and integer durationMS.
comparisons One local-versus-public comparison per public resolver/type: type, resolver, result.
comparisonPolicy Human-readable explanation of comparison semantics.

answers and cnameChain contain canonical DNS RR text. TTLs are set to zero for comparison/display, relevant DNS names are lowercased, duplicate answers are removed and answer ordering is ignored. TXT text is preserved. The CNAME chain contains only aliases reachable from the requested owner, in traversal order. Network/timeout failures appear as per-result error, with an empty rcode if no DNS reply arrived; accepted diagnostic requests still return HTTP 200.

Comparison result Meaning
match Same RCODE, same complete CNAME chain and identical normalized answers. Two matching empty answer sets also match.
compatible Same RCODE/chain and one nonempty answer set is a subset of the other; or NOERROR with the same nonempty CNAME chain and an alias-only answer on one side.
different Different RCODE, chain or incompatible answer sets.
unavailable Either individual query result has an error.

Compatibility is a diagnostic classification, not proof that public delegation or all replicas are correct. Public caches and address rotation can produce legitimate temporary differences. See DNS validation.

Readiness, liveness and metrics

/livez returns 200 while its HTTP handler responds; Kubernetes/peer outages do not make it fail. /readyz returns 200 only after valid configuration, a successful complete local source synchronization, a valid local TSIG key and a completed initial attempt for every configured/discovered peer site. A missing credential or disabled site counts as a completed initial attempt. Reachable sites use ordered failover with bounded endpoint deadlines; every peer need not succeed. The route returns 503 while warming, before required initial work completes, or after shutdown begins.

Later source/peer outages keep last-good data and do not automatically revoke readiness. Monitor source and peer freshness independently. /metrics exports Prometheus text (text/plain; version=0.0.4; charset=utf-8) with bounded query-type/ RCODE labels, synchronization, cache, listener, limiting and peer measurements. The full metric inventory is in observability.

Error status codes

Code Typical cause
400 Invalid JSON/schema/record/name/type, missing version, over-limit JSON body, unknown peer, or an invalid synchronization path argument.
403 Supplied browser Origin/Fetch-Site fails the write checks.
404 Unknown API endpoint or malformed peer synchronization route.
405 Wrong method on a JSON route; response includes Allow.
409 Configuration optimistic version conflict.
415 Missing/incorrect Content-Type for a configuration/validation body.
429 Validation concurrency slots exhausted.
503 Configuration backend/read/save/engine validation unavailable, missing management callback, or readiness not yet satisfied.

Readiness failures are plain text, not JSON. Static-server errors and transport timeouts can also use standard HTTP responses rather than the API error envelope. There is no application-specific HTTP 413 for oversized JSON; decoding reports 400. Engine-specific configuration checks can surface as 503 even when the candidate was syntactically valid.

Per-pod and shared state

CR edits, discovered site metadata, Secrets and the logging flag are shared Kubernetes state and converge through each pod’s reload/reconciliation loops. Records, health, revision, peer transfer actions, metrics and validation results are per pod. Separate requests through a load-balanced Service may hit different pods, even during one console refresh. Use each response's podID, and pin a pod when comparing convergence or following a queued transfer. File-mode persistence is the selected file's scope; independent processes/files do not become a shared configuration store automatically.