Skip to main content

extract_tenant_from_cname

Function extract_tenant_from_cname 

Source
pub(crate) fn extract_tenant_from_cname(cname: &str) -> Option<String>
Expand description

Extracts the tenant ID from an environmentd CNAME target.

The CNAME points at the environmentd service, of the form <service>.<namespace>.svc.cluster.local, e.g. environmentd.environment-58cd23ff-a4d7-4bd0-ad85-a6ff29cc86c3-0.svc.cluster.local. The <namespace> is the environment name environment-<tenant_id>-<index>, where <tenant_id> is the tenant’s UUID and <index> is the environment generation.

NOTE: <index> is currently always 0, since a tenant has one environment per region, but this does not rely on that so that multiple environments per tenant can be supported later.