fix(ingress): use gateway hostname for CNAME targets - #122
Closed
phala-agent wants to merge 2 commits into
Closed
phala-agent wants to merge 2 commits into
phala-agent wants to merge 2 commits into
Conversation
Contributor
|
Prefered human reviewed version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use
gateway.<gateway-base-domain>for the traffic CNAME target in the ingress examples, k3s template, and E2E default. Android's hostname-validating resolver rejects the standalone underscore label in the legacy_.<gateway-base-domain>CNAME target.Inspection found that
scripts/dns01.shforwardsGATEWAY_DOMAINto both direct and delegated alias writes, andscripts/tlsalpn.sh/dnsguide.pyforward it to manual/webhook DNS records. The target originates in the deployment configuration. This change updates those shipped inputs and their documentation while preserving explicit operator-provided targets and ACME/routing labels._acme-challenge,_dstack-app-address, and CAA records.RFC rationale
gives the preferred hostname syntax: ASCII letters, digits, and hyphens,
starting with a letter and ending with a letter or digit.
RFC 1123 §2.1
also permits a leading digit; underscores remain outside this hostname syntax.
permits arbitrary DNS labels within length limits, including underscores and
CNAME values, and allows applications to impose their own restrictions.
Thus
_.<gateway-base-domain>is representable in DNS, while the platform'sserver target uses hostname-compatible
gateway.<gateway-base-domain>forclient interoperability. Protocol verification labels such as
_acme-challengeand_dstack-app-addressremain valid for their DNS uses.permits only one canonical target per alias. During migration, atomically
replace each traffic alias's CNAME target, keeping exactly one target at that
owner. Retain old and new gateway address records under their separate names
until existing consumers have migrated and their TTLs have elapsed.
Verification
python -m pytest custom-domain/dstack-ingress/scripts/tests -q— 55 passed, 13 subtests passed.bash custom-domain/dstack-ingress/scripts/tests/test_sanitizers.sh— passed.bash -n custom-domain/dstack-ingress/scripts/tests/e2e-test.sh— passed.config --quietforcustom-domain/dstack-ingress/docker-compose.multi.yamlandk3s/docker-compose.yaml— passed (standalone Compose CLI; test domain inputs, no credentials or deployments).git diff --check— passed../dev.sh check-allwas exercised but is not counted as a clean validation: it returns success while reporting errors; the local Docker CLI initially lacked its Compose plugin, optional linters were absent, and existing examples trigger privileged-container/socket security findings. The changed Compose files were independently validated with the standalone Compose CLI afterward.Rollout / compatibility
Publish and verify
gateway.<gateway-base-domain>at the gateway zone first, with the same ingress addresses and a hostname-valid chain. Pointing it back to_.<gateway-base-domain>preserves the Android failure. Then update each deployment'sGATEWAY_DOMAINand reconcile its traffic CNAME, including delegation-zone aliases. Existing environment overrides remain unchanged; rebuilding the image alone does not migrate them. Keep legacy gateway records until all consumers have moved and DNS TTLs have elapsed. The guide's address-equivalence fallback makes full CNAME-chain inspection necessary during migration.Scope is code, examples, tests, and documentation only. No production DNS changes, deployments, legacy deletions, or merge are performed by this PR.