DNS Zone Management
Phase 5.5 of provisioning creates Azure DNS child zones for each tenant, enabling dedicated subdomains with proper NS delegation and A records pointing to the tenant's ingress IP.
DNS Architecture
matih.ai (platform zone - Terraform managed)
|
+-- acme.matih.ai (tenant child zone)
| A record --> 20.10.30.40 (tenant LoadBalancer IP)
|
+-- beta.matih.ai (tenant child zone)
A record --> 20.10.30.41Provisioning Steps
| Order | Step | Description |
|---|---|---|
| 40 | DEPLOY_INGRESS_CONTROLLER | Deploy dedicated NGINX in tenant namespace |
| 41 | CREATE_DNS_ZONE | Create Azure DNS child zone with NS delegation |
| 42 | CREATE_TENANT_INGRESS | Create K8s Ingress with TLS certificate |
DNS Zone Creation
The AzureDnsService creates a child zone under the platform's DNS zone:
- Create Azure DNS zone resource (e.g.,
acme.matih.ai) - Read the NS records from the new zone
- Create NS delegation records in the parent zone (
matih.ai) - Create A records pointing to the tenant's LoadBalancer IP
- Store the DNS zone resource ID in
tenant.dnsZoneId
Dev vs Production
| Aspect | Dev | Production |
|---|---|---|
| Domain | matih-dev.example.com or nip.io | matih.ai |
| TLS issuer | letsencrypt-staging-dns01 | letsencrypt-prod-dns01 |
| DNS zones | Disabled by default | Child zones per tenant |
| Dedicated ingress | Disabled by default | Enabled |
Related Entities
The Tenant entity stores DNS-related fields:
@Column(name = "domain", length = 255)
private String domain; // Platform-assigned domain
@Column(name = "custom_domain", length = 255)
private String customDomain; // Custom domain (if configured)
@Column(name = "ingress_ip", length = 45)
private String ingressIp; // LoadBalancer IP
@Column(name = "dns_zone_id", length = 500)
private String dnsZoneId; // Azure DNS zone resource IDSource Files
| File | Path |
|---|---|
| AzureDnsService | control-plane/tenant-service/src/main/java/com/matih/tenant/service/AzureDnsService.java |
| TenantIngressService | control-plane/tenant-service/src/main/java/com/matih/tenant/service/TenantIngressService.java |