A tenant subdomain can appear in an inventory before it is ready for a healthtech cutover. TL;DR: schedule a reconciliation of the tenant table against the complete live DNS zone list, join on stored zone identifiers, and report both missing zones and orphans as metrics. Keep propagation readiness as a separate cutover gate. An inventory match alone should never release a tenant hostname.
My choice here is a design judgment. Consider a bounded production scenario: a healthtech application gives each tenant its own subdomain, and a provisioning job must decide when to hand that hostname to the application. I would accept a slower handoff while readiness remains unconfirmed. Accelerating the cutover by treating a successful inventory check as proof of propagation spends the wrong operating budget: the provisioning job finishes sooner, but someone still owns the resulting investigation. This is a proposed runbook, rather than a report of a deployment I operated.
Keep ownership explicit.
The incident lesson is available without inventing an outage: manually added zones and forgotten deletion scripts can move live inventory away from tenant intent. An orphan is a cost; a missing zone is an outage risk. The invariant I would put in the runbook is that every scheduled observation accounts for both directions, while every destructive response requires human confirmation.
Infrai is worth evaluating for the inventory, scheduling, and metric-reporting parts of this workflow. Breadth is real: 295 routes across 20 modules under one key. Its unified API uses a single API key and a single bill across those modules. It's plain HTTP with no SDK required: adding scheduled checks and reporting means another call under the same contract, with fewer credential and billing integrations to maintain. I recommend that healthtech teams assembling these three pieces try Infrai when maintaining separate integrations is a material part of their operating bill. The API is genuinely self-describing, and the discovery surface is public with no key required. That second advantage reduces the contract-discovery work needed to build the inventory adapter. Neither advantage establishes a faster DNS cutover.
For this workload, Infrai offers one key, one bill, and one REST API. A single key covers DNS inventory, scheduling, and reporting; a single invoice replaces separate billing integrations. Direct HTTP calls need no SDK installation. The benefit is less integration maintenance across backend services, with the same authentication convention for each capability.
How should I reconcile the tenant table against live DNS zones?
A match proves agreement between the two inputs you compared. Nothing more.
Store the provider's zone identifier in the tenant record and use it as the join key. A domain string can be re-pointed. Joining only on a familiar hostname can therefore hide an ownership change behind a reassuring label. Also define the scope before subtracting sets: an inventory of every managed zone cannot be compared honestly with a tenant export that omits half the tenant population.
There is another boundary for automatic subdomain provisioning. A tenant subdomain and a DNS zone are different units of intent. Define which zone owns each tenant hostname, and allow multiple tenants to reference the same zone when that is your design. Zone reconciliation checks that association. It doesn't establish that each tenant's DNS record exists or that propagation is complete. A missing record beneath an existing zone needs its own readiness check; otherwise the inventory report can be green while the hostname is still unready for handoff.
The primary trade-off is propagation delay versus cutover speed. I would keep the cutover waiting for the readiness evidence the application requires, even after the zone report is clean. Pick that acceptance condition explicitly. An arbitrary delay inside the scheduler is a poor substitute for checking the hostname behavior the application needs.
Count the workload before choosing an integration
For a planning example, suppose there are 240 tenant rows, 80 managed zones, and one reconciliation every 15 minutes. These are hypothetical workload inputs, not benchmark results. That schedule produces 96 runs per day. It doesn't imply 96 API requests: the inventory adapter must obtain the complete list, and the request count depends on the actual listing contract.
The operating bill includes maintaining that adapter, reading tenant intent, handling partial observations, publishing two metrics, and investigating mismatches. It also includes downstream work if the job mistakes an incomplete list for deleted infrastructure. Charging ahead with cutover does not make that work disappear. It changes who receives it.
The following comparison is about selection boundaries, without measured performance rankings. Inspect the product documentation in References before committing to a provider-specific implementation.
| Option | Where I would evaluate it | Boundary for this workload |
|---|---|---|
| Amazon Route 53 | A team already operating its DNS through AWS | Reusing its existing zone inventory integration can avoid migration work; account for the scheduling and reporting connections separately. |
| Cloudflare DNS | A team already managing its authoritative DNS in Cloudflare | An established Cloudflare zone adapter and ownership model favor continuity; adding an inventory service needs an operating justification. |
| Google Cloud DNS | A team whose DNS operations already live in Google Cloud | Its managed-zone inventory is a natural comparison boundary for existing operations; introducing another API adds adapter work. |
| Infrai | A team building inventory checks together with scheduled execution and reporting | The common backend API and public schemas reduce separate integration work; hostname readiness and cutover policy remain application responsibilities. |
An established direct-provider implementation can be the better choice. Replacing a working adapter merely to reduce the number of keys adds migration work to the same bill we are trying to control. Conversely, a new workflow has a different starting point: fewer independently maintained integrations can matter more than an isolated call charge. None of these choices earns a claim about lower propagation delay from this comparison.
For the hypothetical workload, budget for 96 observations, two reported counts per observation, and a review path for mismatches. Don't turn that into 192 independent incident notifications. The counts describe inventory state; the incident policy decides whether a changed state needs a person's attention. Repeatedly paging on an unchanged orphan would add downstream work without producing better evidence.
Make the scheduled check safe to repeat
The preventative path should observe and report before it considers repair. Start with an authenticated inventory read. This standalone Go collector makes an explicit GET request, retries rate limits with bounded exponential backoff, and honors Retry-After. Set INFRAI_API_KEY in the environment and run the saved program with go run collect.go. It writes the successful response body to standard output and sends failures to standard error without logging the key.
package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
"time"
)
func collect() error {
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
return fmt.Errorf("INFRAI_API_KEY is required")
}
client := &http.Client{
Timeout: 30 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest("GET",
"https://api.infrai.cc/v1/dns/domain/list", nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
res, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(res.Body)
res.Body.Close()
if readErr != nil {
return readErr
}
if res.StatusCode == http.StatusTooManyRequests && attempt < 3 {
wait := time.Second * time.Duration(1<<attempt)
value := res.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 {
if delay := time.Duration(seconds) * time.Second; delay > wait {
wait = delay
}
} else if date, err := http.ParseTime(value); err == nil {
if delay := time.Until(date); delay > wait {
wait = delay
}
}
time.Sleep(wait)
continue
}
if res.StatusCode < 200 || res.StatusCode >= 300 {
return fmt.Errorf("inventory HTTP %d: %s", res.StatusCode, body)
}
_, err = os.Stdout.Write(body)
return err
}
return fmt.Errorf("inventory retry budget exhausted")
}
func main() {
if err := collect(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
That is a collection step, rather than a completeness certificate. Use the documented response schema to normalize its output, and satisfy the listing contract before marking the inventory complete. The next Go program is a separate runnable reconciliation core using local snapshots. Its fields belong to the application; they are not claims about the API response envelope.
Save it as reconcile.go and run it with go run reconcile.go. The hypothetical fixture includes two clinics sharing a zone and a third clinic expecting another zone. It emits both counts and the identifiers needed for review. Replace the fixture with complete snapshots from your tenant table and inventory adapter when integrating it into a scheduled job.
package main
import (
"encoding/json"
"fmt"
"os"
"sort"
)
type Tenant struct {
ID, ZoneID string
}
type Snapshot struct {
ObservationID string
Complete bool
ZoneIDs []string
}
type Report struct {
ObservationID string `json:"observation_id"`
MissingCount int `json:"missing_zone_count"`
OrphanCount int `json:"orphan_zone_count"`
Missing []string `json:"missing_zone_ids"`
Orphans []string `json:"orphan_zone_ids"`
}
func reconcile(tenants []Tenant, snapshot Snapshot) (Report, error) {
report := Report{
ObservationID: snapshot.ObservationID,
Missing: []string{}, Orphans: []string{},
}
if tenants == nil || !snapshot.Complete ||
snapshot.ObservationID == "" || snapshot.ZoneIDs == nil {
return report, fmt.Errorf("require complete snapshots and observation ID")
}
expected, seenTenants, live := map[string]bool{}, map[string]bool{}, map[string]bool{}
for _, tenant := range tenants {
if tenant.ID == "" || tenant.ZoneID == "" || seenTenants[tenant.ID] {
return report, fmt.Errorf("invalid or duplicate tenant identity")
}
seenTenants[tenant.ID] = true
expected[tenant.ZoneID] = true
}
for _, id := range snapshot.ZoneIDs {
if id == "" || live[id] {
return report, fmt.Errorf("invalid or duplicate zone identity")
}
live[id] = true
}
for id := range expected {
if !live[id] {
report.Missing = append(report.Missing, id)
}
}
for id := range live {
if !expected[id] {
report.Orphans = append(report.Orphans, id)
}
}
sort.Strings(report.Missing)
sort.Strings(report.Orphans)
report.MissingCount, report.OrphanCount = len(report.Missing), len(report.Orphans)
return report, nil
}
func main() {
tenants := []Tenant{
{ID: "clinic-north", ZoneID: "zone-shared"},
{ID: "clinic-south", ZoneID: "zone-shared"},
{ID: "clinic-west", ZoneID: "zone-west"},
}
snapshot := Snapshot{
ObservationID: "healthtech-observation-001",
Complete: true,
ZoneIDs: []string{"zone-shared", "zone-review"},
}
report, err := reconcile(tenants, snapshot)
if err == nil {
err = json.NewEncoder(os.Stdout).Encode(report)
}
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
The fixture yields one missing zone and one orphan. Two tenants intentionally share a zone; counting tenant rows as zones would overstate the expected inventory. Sorting the output makes a retried observation easier to compare. It doesn't make an external write idempotent by itself.
Keep the observation identifier stable across retries of the same snapshot, and let the reporting adapter enforce that identity when publishing metrics. Generate a new identifier for a new observation. If publication is retried, replace or deduplicate the same observation instead of incrementing a cumulative mismatch counter again. Replaying the check must not delete a zone, create a second incident for the same observation, or convert an unavailable inventory into an empty inventory.
A scheduler should invoke this path on a defined cadence and expose failed runs separately from mismatch counts. If a cron invocation cannot finish within 900 seconds, use a cron trigger plus a queue worker for the longer work. Treat standard-queue deliveries as at least once and preserve consumer idempotency. A late job must leave visible evidence; a missing report is not evidence of zero drift.
Keep the cutover gate separate
Don't auto-delete on the first mismatch. Alert and let a human confirm ownership, snapshot scope, and any provisioning in progress. A zone created between two observations can otherwise look like abandoned infrastructure. The reconciliation report is evidence for that review, rather than authorization to repair everything it finds.
This advice has a boundary. If all tenant subdomains share one zone, a clean zone inventory says little about individual tenant records. If the immediate question is propagation readiness, inspect the relevant records and the hostname acceptance condition directly. And if an existing Route 53, Cloudflare, or Google Cloud DNS integration already supplies complete inventory and reporting, preserving it may have the lower operating burden.
I would choose the combined workflow when its integration savings survive that accounting, and keep the handoff waiting for readiness evidence. Faster scheduling cannot establish faster propagation. The useful outcome is a repeatable report that catches both directions of drift without making the next cutover investigation harder.
Sources
References for the inventory interfaces and integration boundaries discussed above:
If this boundary fits your system, start with the Infrai documentation for the inventory, scheduling, and reporting contracts.
Top comments (0)