Skip to content

feat: Reserve every name beneath a wildcard for its project - #529

Draft
scotwells wants to merge 1 commit into
feat/wildcard-dns-recordsfrom
feat/wildcard-subtree-claims
Draft

scotwells wants to merge 1 commit into
feat/wildcard-dns-recordsfrom
feat/wildcard-subtree-claims

Conversation

@scotwells

Copy link
Copy Markdown
Contributor

Summary

The edge prefers an exact hostname over a wildcard, so a project that could claim one name beneath another project's wildcard would take that name's traffic.

Hostname claims now cover whole subtrees, so a wildcard reserves every name beneath it, at any depth, for the project that holds it.

A later claim beneath another project's wildcard is refused, and so is a wildcard while another project holds a name beneath it, with the refusal naming those hostnames but never the project.

This is behind the certificate service setting, which is off by default, and is stacked on #528.

API

No new fields. A refused hostname reports the reason it already uses for a taken hostname, with a message that says what overlaps.

# Project B adds a name beneath project A's wildcard
status:
  conditions:
    - type: HostnamesInUse
      status: "True"
      reason: HostnameInUse
      message: "Hostnames are already attached to another resource: bucket.s3.example.com"
  hostnameStatuses:
    - hostname: bucket.s3.example.com
      conditions:
        - type: Available
          status: "False"
          reason: InUse
          message: >-
            The hostname "bucket.s3.example.com" is beneath the wildcard
            "*.s3.example.com", which another project has claimed. Taking
            names back from another project is not supported yet; that project
            must remove its wildcard first.
# Project B adds a wildcard while project A serves names beneath it
    - hostname: "*.s3.example.com"
      conditions:
        - type: Available
          status: "False"
          reason: InUse
          message: >-
            The wildcard "*.s3.example.com" cannot be claimed while another
            project serves names beneath it: a.b.s3.example.com,
            photos.s3.example.com. Taking names back from another project is
            not supported yet; that project must remove them first.
Claim Another project holds Result
bucket.s3.example.com *.s3.example.com refused
a.b.s3.example.com *.s3.example.com refused, at any depth
*.s3.example.com photos.s3.example.com refused, names listed (first five, then a count)
*.s3.example.com *.example.com or *.b.s3.example.com refused
*.s3.example.com s3.example.com allowed, since a wildcard does not cover its base
anything the same project holds the overlap allowed

Naming hostnames tells the requester which names exist beneath a domain they have already proven they own. Project identities are never shown.

Reclaiming a name from another project is out of scope. Hosted zone claims (datum-cloud/enhancements#917) will define that override for hostnames and zones together, so the refusal says it is not supported yet.

Claims stay one record per hostname on the platform control plane. A wildcard's record is named from a hash of its base, because a record name cannot hold an asterisk, and that name has no dot, so it never collides with an exact hostname's record.

Finding a wildcard above a name is one cached lookup per parent domain. Finding names beneath a wildcard uses an in-memory index of every parent domain of every claim, so no request scans the claims. The index exists only with the setting on.

Claims are rechecked on every pass. When two overlapping claims race past each other's cache, the older one keeps its name and the newer one is released.

Test plan

  • Unit tests refuse a later name beneath another project's wildcard, a wildcard over another project's names, and overlapping wildcards, and let one project hold both
  • Two claims that raced settle on the older one, and a removed wildcard releases its claim
  • Build, vet, lint and the full suite pass locally and in CI
  • With the setting off, claims behave as before

Related to datum-cloud/enhancements#913

The edge prefers an exact hostname over a wildcard, so if another project
could claim bucket.s3.example.com under someone's *.s3.example.com it
would take that traffic. Hostname claims now cover subtrees behind the
certificate service flag: a wildcard reserves every name beneath it, at
any depth, for its project.

Key changes:
- refuse a claim beneath another project's wildcard, and a wildcard
  while another project holds a name beneath it; the refusal names the
  hostnames, never the project, and says reclaiming is not supported yet
- name wildcard claims from a hash of their base, with the hostname in
  their data, since a ConfigMap name cannot hold "*"; the name has no
  dot so it never meets a custom hostname's claim
- find wildcards above a name with one cached GET per parent domain,
  and names beneath a wildcard with a cache index on every parent
  domain, so no lookup scans the claim namespace
- re-check held claims every reconcile and keep the older of two that
  raced, so a cache-lag race settles the same way on both sides
- carry the refusal onto the hostname's Available condition
@scotwells
scotwells force-pushed the feat/wildcard-subtree-claims branch from 0eb1775 to 66f7c49 Compare October 2, 2026 23:35
@scotwells
scotwells force-pushed the feat/wildcard-dns-records branch from b08f52f to 2478d6d Compare October 2, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant