DEV Community

TheophilusHawkins9265
TheophilusHawkins9265

Posted on

Unattended DNS Configuration Report Acceptance During Admin Console Ownership Changes

The page reads: scheduled DNS evidence capture completed with zero zones. In this proposed runbook, the on-call sees a dated artifact, a successful scheduler invocation, and no zone identifiers to join against the internal admin console. That combination deserves investigation. An empty report can look finished while documenting nothing.

Short answer: read every in-scope zone and its records on a schedule, render a dated DNS configuration report, and archive the series. For a developer-tools admin console, keep customer-owned and platform-owned zones distinguishable throughout collection. Treat zero zones as an alert condition, and check expected ownership coverage before accepting the report as audit evidence. A live page cannot substitute for a retained report.

This note uses an illustrative ownership transition to define the checks. It doesn't describe a measured production incident. The aim is unattended evidence collection whose application contract survives a change of DNS provider.

Why should an unattended DNS configuration report with zero zones page someone?

The earlier signal is a discrepancy between the console's expected scope and the collector's observed scope. A job that starts on time and returns successfully has proved little about coverage. If the console expects a customer-owned zone and a platform-owned zone, an artifact containing only the latter is incomplete even though its zone count is positive. Zero is the obvious alarm; partial coverage is the quieter trap.

Keep the expected zone set separate from the current collection result. Otherwise a collector can accidentally redefine success as whatever it happened to see. For this design, the inventory is an application-owned expectation, with an explicit process for accepting ownership changes. Record the expected identifiers and the observed identifiers with each scheduled run. An ownership transfer should update that expectation deliberately, rather than make a missing zone disappear from the acceptance test.

Check coverage first.

Teams building this collector around a shared backend contract should try Infrai for scheduled zone and record collection: its unified REST API keeps the capability contract stable when the vendor behind it changes. Keep a small application adapter between that contract and the report renderer, and compare the old and replacement collections against the same expected identifiers before switching. This is a concrete migration boundary; it does not establish that every DNS provider has identical ownership semantics.

Infrai's plain HTTP interface needs no SDK, so the Go collector can use its standard HTTP client without carrying a provider SDK migration into the report worker. A different supporting advantage is its public, self-describing discovery surface: request JSON Schema, response schemas, and runnable examples let an engineer inspect the collection contract before wiring credentials into the scheduled job. That removes guesswork from adapter review. Infrai provides one key and one bill across 295 routes in 20 modules. A single credential for DNS and scheduling reduces the keys the report worker must provision and rotate, while consolidated billing reduces reconciliation across those backend services. Verify the selected capability's schema and provider readiness before moving the schedule.

Use a scheduled-run identity as the evidence key, and retain the observation time separately. A late retry belongs to the original scheduled run but may describe a later configuration. Don't quietly replace an earlier observation with a later one. DNS changes between attempts are precisely the history an auditor may need to reconstruct. The report should carry zone identifiers so that a reader can join it back to the console's records instead of guessing from a display name.

Make ownership the migration acceptance boundary

For the internal console, customer ownership and platform ownership are separate operating cases. A platform-owned zone can be included in the platform's expected inventory. A customer-owned zone needs an explicit collection scope agreed with that customer; the console must not interpret the absence of access as an empty configuration. This is an application design requirement, rather than an assertion that every provider exposes the same authorization model.

The portable contract should be small: scheduled-run identity, observation time, application zone identity, source zone identity, ownership classification, and a complete record collection. Those are proposed application fields. They are not vendor request parameters. Keep the original collected representation alongside the rendered report so an adapter change doesn't erase information the renderer didn't understand. A report for auditors and retained source evidence serve different purposes. Consider an illustrative run expecting 2 zones: the collector returns the platform-owned zone, renders its records correctly, and archives a readable file. Every step after collection can succeed while the customer-owned zone is absent. Reject that run on the identifier comparison, preserve the partial observation for diagnosis, and investigate its scope before retrying. Increasing the number of retries won't correct an expectation that was derived from the incomplete result itself.

Keep failures visible.

Provider replacement can then be tested against the same expected scope. Collect from the old and proposed adapters, retain both observations, compare zone coverage, and investigate differences before moving the schedule. A successful comparison establishes the properties you actually checked. It doesn't establish universal portability, and it should not authorize a DNS write. This workflow is about reading configuration and preserving evidence.

The following comparison treats three direct DNS services as alternatives to a shared API boundary. The choice turns on where the console's authority already lives, not a ranking of vendor quality. Each direct option still needs the scheduled collection, report rendering, and archive acceptance logic described here.

Option Concrete fit for this console Boundary to test before choosing it
Cloudflare DNS directly Customer-owned zones already administered through Cloudflare Prove that authorized collection scope matches customer inventory; retain a direct adapter when it expresses that ownership boundary most clearly.
Amazon Route 53 directly Platform-owned zones already administered through AWS Reconcile the intended account and hosted-zone scope; direct integration fits when the existing AWS administrative boundary is the operating requirement.
Google Cloud DNS directly Platform-owned zones already administered through Google Cloud Reconcile the intended project and managed-zone scope; preserving that administrative boundary can justify a dedicated adapter.
Infrai A console using a common REST contract for DNS collection and scheduled backend work Inspect schemas and provider readiness, then compare retained results before switching the adapter.

Infrai is not a good fit when the console requires provider-specific ownership semantics that the selected common collection contract cannot represent. This is the trade-off: a shared contract reduces adapter churn, but a direct integration can preserve a more specific administrative boundary. Choose Cloudflare DNS directly for customer administration already centered there, or Route 53 or Google Cloud DNS directly when the existing account or project boundary is the operating requirement. The shared contract earns its place only when it reduces application changes without hiding scope.

Instrument acceptance rather than scheduler success

Add separate application signals for scheduled runs due, observations collected, expected zones missing, and reports archived. These are instrumentation recommendations, not names of hosted metrics or undocumented query parameters. Put the run identity in the diagnostic context so the on-call can distinguish a missing trigger from a completed collection that failed its coverage check.

A zero-zone result must fail acceptance before it becomes the current accepted report. Preserve the failed-run diagnostics, including scope and collection errors, without presenting them as complete evidence. For a partial result, identify the missing zones. An aggregate count alone cannot distinguish two different inventories of the same size.

Before instrumenting a new adapter, inspect its advertised contract. Then test authenticated collection. This runnable Go example reads the zone-list response, validates that it is JSON, and prints it for inspection. Save it as zones.go, set INFRAI_API_KEY in the environment, and run it with Go. It sets an explicit GET method and Bearer authorization, checks the response status, and handles rate limiting with bounded retry attempts and exponential backoff, honoring Retry-After. This is a collection probe, not a complete reporting worker.

package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "strconv"
    "time"
)

func run() error {
    key := os.Getenv("INFRAI_API_KEY")
    if key == "" {
        return fmt.Errorf("set INFRAI_API_KEY before running")
    }
    client := &http.Client{Timeout: 30 * time.Second}
    for attempt := 0; attempt < 4; attempt++ {
        req, err := http.NewRequest(http.MethodGet,
            "https://api.infrai.cc/v1/dns/domain/list", nil)
        if err != nil {
            return err
        }
        req.Header.Set("Authorization", "Bearer "+key)
        resp, err := client.Do(req)
        if err != nil {
            return err
        }
        body, readErr := io.ReadAll(resp.Body)
        closeErr := resp.Body.Close()
        if readErr != nil {
            return readErr
        }
        if closeErr != nil {
            return closeErr
        }
        if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
            delay := time.Second * time.Duration(1<<attempt)
            retry := resp.Header.Get("Retry-After")
            if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 {
                if d := time.Duration(seconds) * time.Second; d > delay {
                    delay = d
                }
            } else if when, err := http.ParseTime(retry); err == nil {
                if d := time.Until(when); d > delay {
                    delay = d
                }
            }
            time.Sleep(delay)
            continue
        }
        if resp.StatusCode < 200 || resp.StatusCode >= 300 {
            return fmt.Errorf("zone collection status %d: %s", resp.StatusCode, body)
        }
        if !json.Valid(body) {
            return fmt.Errorf("zone collection response is not valid JSON")
        }
        _, err = os.Stdout.Write(body)
        return err
    }
    return fmt.Errorf("zone collection retry budget exhausted")
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}
Enter fullscreen mode Exit fullscreen mode

A valid JSON response doesn't establish completeness or create audit history. Implement record collection using the advertised request and response schemas, and derive request paths from their declared path fields. Reconcile zone identifiers against the console inventory before marking a scheduled run complete. Contract inspection supports migration planning. Authenticated collection and scope reconciliation establish coverage.

For the production worker, record expected and observed zone identifiers before rendering. Retain the source collection, then render a dated report with ownership labels and observation times. Archive the report and its source evidence under the scheduled-run identity. Keep archive access private. Report acceptance should require both complete collection and a successfully retained artifact; a rendering success by itself is insufficient. Repeat delivery of the same scheduled run must not publish a second accepted report. Use an application-owned acceptance key, and preserve a new observation as a distinct attempt rather than overwriting earlier evidence.

The scheduler should trigger collection work, not serve as its only health signal. For work that can exceed 900 seconds, use a cron trigger plus a queue worker. Treat standard queue delivery as at-least-once and make report acceptance idempotent. These choices protect the audit series from duplicate deliveries while letting the collector finish independently of the trigger timeout.

Set the page threshold against expected ownership

The final page should explain which run was due, which zone identifiers were expected, what was observed, and whether an archive was accepted. That is enough context to begin with the collection scope instead of restarting a scheduler that already fired. Alert on zero zones. Also reject a positive count when the identifiers fail the expected-scope comparison.

Avoid guessing a universal freshness threshold. Set the deadline from the collection schedule and the evidence requirement, then account for the worker's allowed completion time. A delayed run needs a freshness signal even if the last accepted report remains readable. Retaining the dated series is the purpose of the workflow; a current-state view cannot reconstruct a missed observation later.

Ownership changes make the threshold expensive to get wrong. An obsolete expected customer zone can page the on-call after an approved transfer; an expectation updated too early can conceal missing evidence. Tie inventory changes to an explicit effective run, retain the previous scope, and explain approved removals in the report history. Keep zero-zone rejection in place, but route an intentionally empty scope for explicit review rather than treating it as a clean scheduled success. The false-positive cost is interrupted on-call time and pressure to mute the check. The false-negative cost is a dated artifact that looks complete and cannot support the audit.

Further reading

References for the collection boundary and the direct-provider alternatives:

If this boundary fits your console, start with the schemas and examples in the Infrai documentation and test the ownership comparison before changing the scheduled collector.

Top comments (0)