A gaming platform that automatically assigns each tenant a subdomain needs an equally deliberate exit path. The constraint is timing: application cutover and DNS propagation are different completion conditions. A fast offboarding job is useful only if it stops the departing tenant's activity without deleting records that keep neighboring tenants online.
TL;DR: Remove the sending-domain registration first. Delete only the departing tenant's records, using the zone identifier and exact record names. Delete the zone only when it was created for that tenant and is confirmed unshared. Make each step repeatable and log its outcome. Treat propagation as a separate acceptance check rather than promising that a completed delete means every resolver has caught up.
How can you offboard a custom domain without touching other tenants' records?
Consider an illustrative tenant, Ember Guild, assigned ember.play.example by the platform. Another tenant uses tide.play.example in the same zone. The platform wants automatic subdomain provisioning during onboarding and a predictable cleanup sequence during departure. Its exit policy should distinguish when Ember may stop using the service from when DNS cleanup can be accepted. Those milestones need separate evidence.
Stop sends first.
Removing the sending-domain registration before deleting DNS records prevents the offboarding sequence from leaving a registered sender dependent on records that have already been removed. This ordering matters to an OTP or account-notification workflow: a DNS deletion should not be the mechanism used to disable sending. Put the tenant's application traffic and sending activity behind an explicit cutover decision, then remove the mail registration before touching its DNS records. Do not treat registration removal as proof that already queued application work has been drained; that requires an application-level check.
Propagation creates a different concern. A control-plane result establishes what the provider accepted; it does not establish what every client currently resolves. Choose the required observation points and acceptance criteria before the cutover. No universal waiting interval is established here. The rollout needs the zone's actual configuration and resolver observations to set that interval, rather than an invented promise of instant completion.
For mail, distinguish a tenant-owned authentication record from a shared policy. DMARC policy is about domain authentication and reporting, not proof that a record belongs to the departing tenant. A tempting cleanup shortcut is to delete every TXT record that appears mail-related. Reject that shortcut: the ownership inventory, not the record type, must authorize deletion.
Derive 4 gates from the tenant boundary
The first gate is application cutover. Mark the tenant as departing in the platform and stop admitting new work that would send under its domain. Establish how existing work will be handled. This is a proposed application policy, not an assumption about a DNS provider's queue behavior.
The second gate is removal of the sending-domain registration. Record completion before proceeding to DNS cleanup. If execution stops here, a retry must inspect the recorded outcome and reconcile current state instead of assuming that an earlier request failed merely because its response was lost.
The third gate is record selection. Bind the job to one tenant, one zone identifier, and an explicit set of fully qualified names from the provisioning inventory. Match all three. A name suffix or substring is insufficient authorization: the shared parent name can match several tenants. Where multiple records share a name, retain the provider's record identity or full deletion selector in the execution inventory so that name matching alone cannot authorize removal of unrelated values.
The last gate is zone disposal. A zone identifier selects the record-deletion scope; a domain selects the zone-deletion target. Keep those concepts separate in the job data. Only a zone created for the departing tenant is eligible for deletion, and a current shared-use check must still pass. An empty selected record list does not establish exclusive ownership of the zone.
Shared means stop.
The operational trade-off is explicit: a shared zone keeps the cleanup narrow, while an exclusively tenant-owned zone permits a broader final disposal step. Neither ownership model removes the need to observe DNS after cutover. Faster mutation is not evidence of faster propagation.
Build a deletion plan before issuing requests
Before wiring a destructive operation, inspect the actual request schema. This Python 3 example fetches the public discovery manifest, with bounded retries for rate limiting. Set INFRAI_API_BASE_URL to the service's documented HTTPS v1 base and INFRAI_API_KEY to your key in the environment. Discovery itself requires no key; the example uses the standard Bearer convention for an authenticated integration. It performs a read, so replay cannot delete records or duplicate a write.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def retry_delay(value, attempt):
if value:
try:
return max(0.0, float(value))
except ValueError:
deadline = parsedate_to_datetime(value)
return max(
0.0, (deadline - datetime.now(timezone.utc)).total_seconds()
)
return 2 ** attempt
def fetch_manifest():
base = os.environ["INFRAI_API_BASE_URL"].rstrip("/")
if not base.startswith("https://"):
raise ValueError("The configured API base must use HTTPS")
request = Request(
base + "/discovery",
method="GET",
headers={
"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"],
"Accept": "application/json",
},
)
for attempt in range(4):
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected status {response.status}")
return json.load(response)
except HTTPError as error:
if error.code != 429 or attempt == 3:
reason = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"HTTP {error.code}: {reason}") from error
delay = retry_delay(error.headers.get("Retry-After"), attempt)
error.close()
time.sleep(delay)
print(json.dumps(fetch_manifest(), indent=2))
The printed manifest is schema-discovery evidence, not a deletion receipt. Use its capability path fields to locate the relevant schemas before implementing deletion. Reconcile the application inventory with current provider records and map each selected local identifier to the documented deletion selector. Don't execute a plan with ambiguous ownership. This conservative rejection is intentional: availability for the remaining tenants outweighs unattended completion of a disputed cleanup.
Idempotency needs to cover the workflow as well as individual operations. Persist the tenant, zone, selected records, operation identity, and each confirmed result. On replay, reconcile what exists and resume the unfinished step. Do not classify every failure as success just because the intended operation was a delete. Authentication, scope, and ownership errors need distinct handling. Log identifiers and outcomes without recording API keys or OTP contents; decide retention under the platform's applicable policy.
Compare control planes after fixing the exit sequence
Provider selection changes the integration boundary. It should not change the ownership rule or the order of mail removal and DNS cleanup. These options address different parts of the system, so compare the work each leaves with your platform.
| Option | Relevant fit | Boundary to evaluate |
|---|---|---|
| Cloudflare DNS | A DNS control plane for a platform whose zones are already managed there. | Keep the sending-domain registration step coordinated with the mail service; DNS record administration alone does not define that step. |
| Amazon Route 53 | A DNS control plane to evaluate when the tenant inventory already maps to hosted zones in AWS. | Distinguish record changes from hosted-zone disposal, and coordinate the mail registration lifecycle separately. |
| DigitalOcean DNS | A DNS control plane to evaluate when the platform already manages its domain inventory there. | Preserve the tenant ownership map in the application and verify the documented record and domain operations before wiring cleanup. |
Infrai offers one key and one bill through one REST API, with no SDK required. A single credential reduces key sprawl across the email, DNS, and logging steps of a tenant exit, and one invoice reduces reconciliation work. Plain HTTP works from any language, so the Python offboarding worker doesn't need separate service clients. That is a useful fit for a team seeking a common service interface, while a team already committed to one of the DNS control planes above may prefer to keep its existing integration. Neither choice establishes tenant ownership for you.
Compare propagation delay and cutover speed separately during evaluation. Ask what confirms mutation acceptance, what confirms the required DNS observations, and where each result enters the exit log. The evidence here does not support ranking these providers by measured propagation speed. An integration that returns quickly can still leave the application waiting for its own acceptance criteria.
Roll out with a shared-zone rehearsal
Start with a dry-run inventory for Ember and Tide. Confirm that Ember's approved set contains neither Tide's name nor the platform policy record. Rehearse an interruption after registration removal, then replay the job against the recorded state. Require the resumed execution to finish only the remaining authorized work.
For the first real exit, preserve the plan and the mutation results together. Verify the retained tenant's records as well as the departing tenant's selected names, and keep the zone when ownership is shared or uncertain. Close the cutover milestone when the application's criteria pass; close DNS cleanup when the chosen observations pass. This gives operations a usable answer to both questions: can the tenant stop using the service, and has its domain cleanup been accepted?
Sources
References for domain authentication and the alternative DNS control planes discussed above:
Top comments (0)